08-04-2004, 04:19 AM | #1 |
Guest
|
Static objects and ETOUCH
I'm currently trying to get a grasp of the ROTT source and noticed a strange array subscript in the original source.
RT_ACTOR.H:44: #define MAXTOUCH 10 RT_ACTOR.H:283: _2Dpoint ETOUCH[MAXTOUCH]; This results in an array of 10 _2Dpoint elements with indices 0 to 9. tempstat is of type statobj_t and the struct member linked_to is of type int because the linked object might be another statobj_t or an objtype or something else. This only works on platforms where sizeof(int) equals the size of a pointer. Ok so far nothing special. In RT_STAT.C a pointer to an statobj_t LASTSTAT gets declared. RT_STAT.C:63: statobj_t *LASTSTAT The function void ExplodeStatic(statobj_t*tempstat) contains a line like this: RT_ACTOR.C:10844: tempstat->linked_to = (int)(LASTSTAT); This casts LASTSTAT to int resulting in the address of the statobj_t pointed to by LASTSTAT. This address is now stored in tempstat->linked_to. In void DamageStaticObject(statobj_t*tempstat,int damage) there is a switch case statement Code:
switch (tempstat->itemnumber) { case stat_dariantouch: MISCVARS->ETOUCH[tempstat->linked_to].x = MISCVARS->ETOUCH[tempstat->linked_to].y = 0; I'm not sure what kind of information is stored in the ETOUCH array. Maybe it's some kind of touch position. If anyone knows about this please help me out. Jon Daniel |
Bookmarks |
Tags |
rott, static objects |
|
|