Posted By: tD_Datura_v
Idiotic C-Script Trick #10: ani_t what: - 07/04/08 05:14
Code:
/* Idiotic C-Script Trick #10: ani_t what: A6.60 borrowed in part from user _not credited_ conventions: i = constant? opfunction_Name op_typeName _n = var _v = VECTOR _t = TEXT _e = ENTITY _s = STRING trailing _ = pointer for _s fxp = particle? */ TEXT ani_t1 { pos_x = 0; pos_y = 0; strings = 16; } STRING* ani_s1_; // ez pointer var ani_nt1 = 0; // just index for ani_t1 // animation modes var iStand; var iWalk; var iRun; var iJump; var iDie; var iSwim; define _ani1, skill?; // store animation mode in skill // get a short hand form function anif_get1() { ani_s1_ = ani_t1.string[my._ani1]; } // sets false constant to last index by ref // copies string param to text at last index // increments index function anif_set1(&_n, _s) { _n[0] = ani_nt1; str_cpy(ani_t1.string[ani_nt1], _s); ani_nt1 += 1; } // the function does false auto constants // and helps link var to string function anif_init1() { ani_nt1 = 0; ainf_set1(iStand, "stand"); anif_set1(iWalk, "walk"); anif_set1(iRun, "run"); anif_set1(iJump, "jump"); anif_set1(iDie, "die"); anif_set1(iSwim, "swim"); /* use offsets for more models? */ } //...at start anif_init1(); //... // set animation mode iStand, iWalk, etc. anif_get1(); // now just pass ani_s1_ to ent_animate function