Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Idiotic C-Script Trick #10: ani_t what: #214322
07/04/08 05:14
07/04/08 05:14
Joined: Dec 2005
Posts: 116
T
tD_Datura_v Offline OP
Member
tD_Datura_v  Offline OP
Member
T

Joined: Dec 2005
Posts: 116
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


Re: Idiotic C-Script Trick #10: ani_t what: [Re: tD_Datura_v] #215795
07/13/08 13:22
07/13/08 13:22
Joined: Feb 2008
Posts: 337
V
Vadim647 Offline
Senior Member
Vadim647  Offline
Senior Member
V

Joined: Feb 2008
Posts: 337
Nice. Of course, I know it, but I havent tryed to make it look better than string array.
If it's trick #10, where's other 9? :P


I switched to other account since marth 2010. Guess which.

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1