Commit 3d610c50 authored by Steven Fuller's avatar Steven Fuller

actorat array changed from objtype * to int. (It was originally used as

both).
parent f17076b7
CC = gcc CC = gcc
#CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro #CFLAGS = -g -O2 -Wall -pedantic
#CFLAGS = -g -Wall #CFLAGS = -Wall -pedantic -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
CFLAGS = -g -Wall -pedantic CFLAGS = -g -Wall -pedantic
#CFLAGS = -Os -Wall #CFLAGS = -Os -Wall -peantic
#CFLAGS = -Os -Wall -fomit-frame-pointer -ffast-math -mpentiumpro -mcpu=pentiumpro -march=pentiumpro #CFLAGS = -Os -Wall -peantic -fomit-frame-pointer -ffast-math -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \ OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \
wl_act1.o wl_act2.o wl_act3.o wl_agent.o wl_game.o \ wl_act1.o wl_act2.o wl_act3.o wl_agent.o wl_game.o \
......
...@@ -126,7 +126,7 @@ void SpawnStatic(int tilex, int tiley, int type) ...@@ -126,7 +126,7 @@ void SpawnStatic(int tilex, int tiley, int type)
switch (statinfo[type].type) switch (statinfo[type].type)
{ {
case block: case block:
(unsigned)actorat[tilex][tiley] = 1; // consider it a blocking tile actorat[tilex][tiley] = 1; // consider it a blocking tile
case dressing: case dressing:
laststatobj->flags = 0; laststatobj->flags = 0;
break; break;
...@@ -137,7 +137,7 @@ void SpawnStatic(int tilex, int tiley, int type) ...@@ -137,7 +137,7 @@ void SpawnStatic(int tilex, int tiley, int type)
case bo_crown: case bo_crown:
case bo_fullheal: case bo_fullheal:
if (!loadedgame) if (!loadedgame)
gamestate.treasuretotal++; gamestate.treasuretotal++;
case bo_firstaid: case bo_firstaid:
case bo_key1: case bo_key1:
...@@ -333,7 +333,7 @@ void SpawnDoor(int tilex, int tiley, boolean vertical, int lock) ...@@ -333,7 +333,7 @@ void SpawnDoor(int tilex, int tiley, boolean vertical, int lock)
lastdoorobj->lock = lock; lastdoorobj->lock = lock;
lastdoorobj->action = dr_closed; lastdoorobj->action = dr_closed;
(unsigned)actorat[tilex][tiley] = doornum | 0x80; // consider it a solid wall actorat[tilex][tiley] = doornum | 0x80; // consider it a solid wall
// //
// make the door tile a special tile, and mark the adjacent tiles // make the door tile a special tile, and mark the adjacent tiles
...@@ -384,7 +384,7 @@ void OpenDoor(int door) ...@@ -384,7 +384,7 @@ void OpenDoor(int door)
void CloseDoor(int door) void CloseDoor(int door)
{ {
int tilex,tiley,area; int tilex, tiley, area;
objtype *check; objtype *check;
// //
...@@ -401,18 +401,28 @@ void CloseDoor(int door) ...@@ -401,18 +401,28 @@ void CloseDoor(int door)
if (doorobjlist[door].vertical) if (doorobjlist[door].vertical)
{ {
if ( player->tiley == tiley ) if (player->tiley == tiley)
{ {
if ( ((player->x+MINDIST) >>TILESHIFT) == tilex ) if (((player->x+MINDIST) >>TILESHIFT) == tilex)
return; return;
if ( ((player->x-MINDIST) >>TILESHIFT) == tilex ) if (((player->x-MINDIST) >>TILESHIFT) == tilex)
return; return;
} }
check = actorat[tilex-1][tiley];
if (check && ((check->x+MINDIST) >> TILESHIFT) == tilex ) if (actorat[tilex-1][tiley] & 0x8000)
check = &objlist[actorat[tilex-1][tiley] & ~0x8000];
else
check = NULL;
if (check && ((check->x+MINDIST) >> TILESHIFT) == tilex)
return; return;
check = actorat[tilex+1][tiley];
if (check && ((check->x-MINDIST) >> TILESHIFT) == tilex ) if (actorat[tilex+1][tiley] & 0x8000)
check = &objlist[actorat[tilex+1][tiley] & ~0x8000];
else
check = NULL;
if (check && ((check->x-MINDIST) >> TILESHIFT) == tilex)
return; return;
} }
else if (!doorobjlist[door].vertical) else if (!doorobjlist[door].vertical)
...@@ -424,10 +434,20 @@ void CloseDoor(int door) ...@@ -424,10 +434,20 @@ void CloseDoor(int door)
if ( ((player->y-MINDIST) >>TILESHIFT) == tiley ) if ( ((player->y-MINDIST) >>TILESHIFT) == tiley )
return; return;
} }
check = actorat[tilex][tiley-1];
if (actorat[tilex][tiley-1] & 0x8000)
check = &objlist[actorat[tilex][tiley-1] & ~0x8000];
else
check = NULL;
if (check && ((check->y+MINDIST) >> TILESHIFT) == tiley ) if (check && ((check->y+MINDIST) >> TILESHIFT) == tiley )
return; return;
check = actorat[tilex][tiley+1];
if (actorat[tilex][tiley+1] & 0x8000)
check = &objlist[actorat[tilex][tiley+1] & ~0x8000];
else
check = NULL;
if (check && ((check->y-MINDIST) >> TILESHIFT) == tiley ) if (check && ((check->y-MINDIST) >> TILESHIFT) == tiley )
return; return;
} }
...@@ -447,8 +467,7 @@ void CloseDoor(int door) ...@@ -447,8 +467,7 @@ void CloseDoor(int door)
// //
// make the door space solid // make the door space solid
// //
(unsigned)actorat[tilex][tiley] actorat[tilex][tiley] = door | 0x80;
= door | 0x80;
} }
/* /*
...@@ -587,10 +606,10 @@ void DoorClosing(int door) ...@@ -587,10 +606,10 @@ void DoorClosing(int door)
tilex = doorobjlist[door].tilex; tilex = doorobjlist[door].tilex;
tiley = doorobjlist[door].tiley; tiley = doorobjlist[door].tiley;
if ( ((unsigned)actorat[tilex][tiley] != (door | 0x80)) if ((actorat[tilex][tiley] != (door | 0x80))
|| (player->tilex == tilex && player->tiley == tiley) ) || (player->tilex == tilex && player->tiley == tiley) )
{ // something got inside the door { // something got inside the door
OpenDoor (door); OpenDoor(door);
return; return;
}; };
...@@ -698,7 +717,6 @@ void PushWall(int checkx, int checky, int dir) ...@@ -698,7 +717,6 @@ void PushWall(int checkx, int checky, int dir)
if (pwallstate) if (pwallstate)
return; return;
oldtile = tilemap[checkx][checky]; oldtile = tilemap[checkx][checky];
if (!oldtile) if (!oldtile)
return; return;
...@@ -711,8 +729,7 @@ void PushWall(int checkx, int checky, int dir) ...@@ -711,8 +729,7 @@ void PushWall(int checkx, int checky, int dir)
SD_PlaySound(NOWAYSND); SD_PlaySound(NOWAYSND);
return; return;
} }
(unsigned)actorat[checkx][checky-1] = actorat[checkx][checky-1] = tilemap[checkx][checky-1] = oldtile;
tilemap[checkx][checky-1] = oldtile;
break; break;
case di_east: case di_east:
...@@ -721,8 +738,7 @@ void PushWall(int checkx, int checky, int dir) ...@@ -721,8 +738,7 @@ void PushWall(int checkx, int checky, int dir)
SD_PlaySound(NOWAYSND); SD_PlaySound(NOWAYSND);
return; return;
} }
(unsigned)actorat[checkx+1][checky] = actorat[checkx+1][checky] = tilemap[checkx+1][checky] = oldtile;
tilemap[checkx+1][checky] = oldtile;
break; break;
case di_south: case di_south:
...@@ -731,8 +747,7 @@ void PushWall(int checkx, int checky, int dir) ...@@ -731,8 +747,7 @@ void PushWall(int checkx, int checky, int dir)
SD_PlaySound(NOWAYSND); SD_PlaySound(NOWAYSND);
return; return;
} }
(unsigned)actorat[checkx][checky+1] = actorat[checkx][checky+1] = tilemap[checkx][checky+1] = oldtile;
tilemap[checkx][checky+1] = oldtile;
break; break;
case di_west: case di_west:
...@@ -741,8 +756,7 @@ void PushWall(int checkx, int checky, int dir) ...@@ -741,8 +756,7 @@ void PushWall(int checkx, int checky, int dir)
SD_PlaySound(NOWAYSND); SD_PlaySound(NOWAYSND);
return; return;
} }
(unsigned)actorat[checkx-1][checky] = actorat[checkx-1][checky] = tilemap[checkx-1][checky] = oldtile;
tilemap[checkx-1][checky] = oldtile;
break; break;
} }
...@@ -788,7 +802,7 @@ void MovePWalls() ...@@ -788,7 +802,7 @@ void MovePWalls()
// the tile can now be walked into // the tile can now be walked into
// //
tilemap[pwallx][pwally] = 0; tilemap[pwallx][pwally] = 0;
(unsigned)actorat[pwallx][pwally] = 0; actorat[pwallx][pwally] = 0;
*(mapsegs[0]+farmapylookup[pwally]+pwallx) = player->areanumber+AREATILE; *(mapsegs[0]+farmapylookup[pwally]+pwallx) = player->areanumber+AREATILE;
// //
...@@ -813,7 +827,7 @@ void MovePWalls() ...@@ -813,7 +827,7 @@ void MovePWalls()
pwallstate = 0; pwallstate = 0;
return; return;
} }
(unsigned)actorat[pwallx][pwally-1] = actorat[pwallx][pwally-1] =
tilemap[pwallx][pwally-1] = oldtile; tilemap[pwallx][pwally-1] = oldtile;
break; break;
...@@ -824,7 +838,7 @@ void MovePWalls() ...@@ -824,7 +838,7 @@ void MovePWalls()
pwallstate = 0; pwallstate = 0;
return; return;
} }
(unsigned)actorat[pwallx+1][pwally] = actorat[pwallx+1][pwally] =
tilemap[pwallx+1][pwally] = oldtile; tilemap[pwallx+1][pwally] = oldtile;
break; break;
...@@ -835,7 +849,7 @@ void MovePWalls() ...@@ -835,7 +849,7 @@ void MovePWalls()
pwallstate = 0; pwallstate = 0;
return; return;
} }
(unsigned)actorat[pwallx][pwally+1] = actorat[pwallx][pwally+1] =
tilemap[pwallx][pwally+1] = oldtile; tilemap[pwallx][pwally+1] = oldtile;
break; break;
...@@ -846,7 +860,7 @@ void MovePWalls() ...@@ -846,7 +860,7 @@ void MovePWalls()
pwallstate = 0; pwallstate = 0;
return; return;
} }
(unsigned)actorat[pwallx-1][pwally] = actorat[pwallx-1][pwally] =
tilemap[pwallx-1][pwally] = oldtile; tilemap[pwallx-1][pwally] = oldtile;
break; break;
} }
......
...@@ -180,8 +180,7 @@ void A_Smoke(objtype *ob) ...@@ -180,8 +180,7 @@ void A_Smoke(objtype *ob)
boolean ProjectileTryMove(objtype *ob) boolean ProjectileTryMove(objtype *ob)
{ {
int xl,yl,xh,yh,x,y; int xl,yl,xh,yh,x,y;
objtype *check;
xl = (ob->x-PROJSIZE) >>TILESHIFT; xl = (ob->x-PROJSIZE) >>TILESHIFT;
yl = (ob->y-PROJSIZE) >>TILESHIFT; yl = (ob->y-PROJSIZE) >>TILESHIFT;
...@@ -191,8 +190,7 @@ boolean ProjectileTryMove(objtype *ob) ...@@ -191,8 +190,7 @@ boolean ProjectileTryMove(objtype *ob)
/* check for solid walls */ /* check for solid walls */
for (y=yl;y<=yh;y++) { for (y=yl;y<=yh;y++) {
for (x=xl;x<=xh;x++) { for (x=xl;x<=xh;x++) {
check = actorat[x][y]; if (actorat[x][y] && !(actorat[x][y] & 0x8000))
if (check && check < objlist)
return false; return false;
} }
} }
...@@ -437,7 +435,7 @@ void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir) ...@@ -437,7 +435,7 @@ void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir)
new->flags |= FL_SHOOTABLE; new->flags |= FL_SHOOTABLE;
new->active = true; new->active = true;
actorat[new->tilex][new->tiley] = NULL; // don't use original spot actorat[new->tilex][new->tiley] = 0; // don't use original spot
switch (dir) switch (dir)
{ {
...@@ -455,7 +453,7 @@ void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir) ...@@ -455,7 +453,7 @@ void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir)
break; break;
} }
actorat[new->tilex][new->tiley] = new; actorat[new->tilex][new->tiley] = new->id | 0x8000;
} }
...@@ -1220,22 +1218,22 @@ moveok: ...@@ -1220,22 +1218,22 @@ moveok:
yl = (ob->y-MINDIST) >> TILESHIFT; yl = (ob->y-MINDIST) >> TILESHIFT;
yh = (ob->y+MINDIST) >> TILESHIFT; yh = (ob->y+MINDIST) >> TILESHIFT;
for (y=yl ; y<=yh ; y++) for (y = yl; y <= yh; y++)
for (x=xl ; x<=xh ; x++) for (x = xl; x <= xh; x++)
{ {
tile = (unsigned)actorat[x][y]; tile = actorat[x][y];
if (!tile) if (!tile)
continue; continue;
if (tile<256) if (tile < 256)
return; return;
if (((objtype *)tile)->flags&FL_SHOOTABLE) if (objlist[tile & ~0x8000].flags & FL_SHOOTABLE)
return; return;
} }
ob->flags |= FL_AMBUSH | FL_SHOOTABLE; ob->flags |= FL_AMBUSH | FL_SHOOTABLE;
ob->flags &= ~FL_ATTACKMODE; ob->flags &= ~FL_ATTACKMODE;
ob->dir = nodir; ob->dir = nodir;
NewState (ob,s_spectrewait1); NewState(ob, s_spectrewait1);
} }
...@@ -2395,10 +2393,9 @@ void T_BJDone(objtype *ob) ...@@ -2395,10 +2393,9 @@ void T_BJDone(objtype *ob)
=============== ===============
*/ */
boolean CheckPosition (objtype *ob) boolean CheckPosition(objtype *ob)
{ {
int x,y,xl,yl,xh,yh; int x, y, xl, yl, xh, yh;
objtype *check;
xl = (ob->x-PLAYERSIZE) >>TILESHIFT; xl = (ob->x-PLAYERSIZE) >>TILESHIFT;
yl = (ob->y-PLAYERSIZE) >>TILESHIFT; yl = (ob->y-PLAYERSIZE) >>TILESHIFT;
...@@ -2412,8 +2409,7 @@ boolean CheckPosition (objtype *ob) ...@@ -2412,8 +2409,7 @@ boolean CheckPosition (objtype *ob)
for (y=yl;y<=yh;y++) for (y=yl;y<=yh;y++)
for (x=xl;x<=xh;x++) for (x=xl;x<=xh;x++)
{ {
check = actorat[x][y]; if (actorat[x][y] && !(actorat[x][y] & 0x8000))
if (check && check<objlist)
return false; return false;
} }
......
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
// //
long thrustspeed; long thrustspeed;
unsigned plux,pluy; // player coordinates scaled to unsigned unsigned plux, pluy; // player coordinates scaled to unsigned
int anglefrac; int anglefrac;
int gotgatgun; // JR int gotgatgun;
objtype *LastAttacker; objtype *LastAttacker;
...@@ -52,9 +52,9 @@ struct atkinf ...@@ -52,9 +52,9 @@ struct atkinf
{ {6,0,1},{6,1,2},{6,4,3},{6,-1,4} }, { {6,0,1},{6,1,2},{6,4,3},{6,-1,4} },
}; };
void DrawWeapon (void); void DrawWeapon();
void GiveWeapon (int weapon); void GiveWeapon(int weapon);
void GiveAmmo (int ammo); void GiveAmmo(int ammo);
/* /*
============================================================================= =============================================================================
...@@ -81,11 +81,11 @@ void CheckWeaponChange() ...@@ -81,11 +81,11 @@ void CheckWeaponChange()
if (!gamestate.ammo) // must use knife with no ammo if (!gamestate.ammo) // must use knife with no ammo
return; return;
for (i=wp_knife ; i<=gamestate.bestweapon ; i++) for (i = wp_knife; i <= gamestate.bestweapon; i++)
if (buttonstate[bt_readyknife+i-wp_knife]) if (buttonstate[bt_readyknife+i-wp_knife])
{ {
gamestate.weapon = gamestate.chosenweapon = i; gamestate.weapon = gamestate.chosenweapon = i;
DrawWeapon (); DrawWeapon();
return; return;
} }
} }
...@@ -726,7 +726,7 @@ void GetBonus (statobj_t *check) ...@@ -726,7 +726,7 @@ void GetBonus (statobj_t *check)
boolean TryMove(objtype *ob) boolean TryMove(objtype *ob)
{ {
int xl,yl,xh,yh,x,y; int xl,yl,xh,yh,x,y;
objtype *check; objtype *check;
long deltax,deltay; long deltax,deltay;
...@@ -742,8 +742,7 @@ boolean TryMove(objtype *ob) ...@@ -742,8 +742,7 @@ boolean TryMove(objtype *ob)
for (y=yl;y<=yh;y++) for (y=yl;y<=yh;y++)
for (x=xl;x<=xh;x++) for (x=xl;x<=xh;x++)
{ {
check = actorat[x][y]; if (actorat[x][y] && !(actorat[x][y] & 0x8000))
if (check && check<objlist)
return false; return false;
} }
...@@ -762,18 +761,20 @@ boolean TryMove(objtype *ob) ...@@ -762,18 +761,20 @@ boolean TryMove(objtype *ob)
for (y=yl;y<=yh;y++) for (y=yl;y<=yh;y++)
for (x=xl;x<=xh;x++) for (x=xl;x<=xh;x++)
{ {
check = actorat[x][y]; if (actorat[x][y] & 0x8000) {
if (check > objlist check = &objlist[actorat[x][y] & ~0x8000];
&& (check->flags & FL_SHOOTABLE) )
{
deltax = ob->x - check->x;
if (deltax < -MINACTORDIST || deltax > MINACTORDIST)
continue;
deltay = ob->y - check->y;
if (deltay < -MINACTORDIST || deltay > MINACTORDIST)
continue;
return false; if (check->flags & FL_SHOOTABLE)
{
deltax = ob->x - check->x;
if (deltax < -MINACTORDIST || deltax > MINACTORDIST)
continue;
deltay = ob->y - check->y;
if (deltay < -MINACTORDIST || deltay > MINACTORDIST)
continue;
return false;
}
} }
} }
...@@ -798,7 +799,7 @@ void ClipMove(objtype *ob, long xmove, long ymove) ...@@ -798,7 +799,7 @@ void ClipMove(objtype *ob, long xmove, long ymove)
ob->x = basex+xmove; ob->x = basex+xmove;
ob->y = basey+ymove; ob->y = basey+ymove;
if (TryMove (ob)) if (TryMove(ob))
return; return;
if (noclip && ob->x > 2*TILEGLOBAL && ob->y > 2*TILEGLOBAL && if (noclip && ob->x > 2*TILEGLOBAL && ob->y > 2*TILEGLOBAL &&
...@@ -811,12 +812,12 @@ void ClipMove(objtype *ob, long xmove, long ymove) ...@@ -811,12 +812,12 @@ void ClipMove(objtype *ob, long xmove, long ymove)
ob->x = basex+xmove; ob->x = basex+xmove;
ob->y = basey; ob->y = basey;
if (TryMove (ob)) if (TryMove(ob))
return; return;
ob->x = basex; ob->x = basex;
ob->y = basey+ymove; ob->y = basey+ymove;
if (TryMove (ob)) if (TryMove(ob))
return; return;
ob->x = basex; ob->x = basex;
......
...@@ -768,7 +768,7 @@ extern unsigned farmapylookup[MAPSIZE]; ...@@ -768,7 +768,7 @@ extern unsigned farmapylookup[MAPSIZE];
extern byte tilemap[MAPSIZE][MAPSIZE]; // wall values only extern byte tilemap[MAPSIZE][MAPSIZE]; // wall values only
extern byte spotvis[MAPSIZE][MAPSIZE]; extern byte spotvis[MAPSIZE][MAPSIZE];
extern objtype *actorat[MAPSIZE][MAPSIZE]; extern int actorat[MAPSIZE][MAPSIZE];
extern boolean singlestep,godmode,noclip; extern boolean singlestep,godmode,noclip;
......
...@@ -493,10 +493,10 @@ void SetupGameLevel() ...@@ -493,10 +493,10 @@ void SetupGameLevel()
tile = *map++; tile = *map++;
if (tile < AREATILE) { /* solid wall */ if (tile < AREATILE) { /* solid wall */
tilemap[x][y] = tile; tilemap[x][y] = tile;
(unsigned)actorat[x][y] = tile; actorat[x][y] = tile;
} else { /* area floor */ } else { /* area floor */
tilemap[x][y] = 0; tilemap[x][y] = 0;
actorat[x][y] = NULL; actorat[x][y] = 0;
} }
} }
...@@ -553,8 +553,8 @@ void SetupGameLevel() ...@@ -553,8 +553,8 @@ void SetupGameLevel()
if (tile == AMBUSHTILE) if (tile == AMBUSHTILE)
{ {
tilemap[x][y] = 0; tilemap[x][y] = 0;
if ((unsigned)actorat[x][y] == AMBUSHTILE) if (actorat[x][y] == AMBUSHTILE)
actorat[x][y] = NULL; actorat[x][y] = 0;
if (*map >= AREATILE) if (*map >= AREATILE)
tile = *map; tile = *map;
......
...@@ -23,7 +23,7 @@ boolean singlestep,godmode,noclip; ...@@ -23,7 +23,7 @@ boolean singlestep,godmode,noclip;
byte tilemap[MAPSIZE][MAPSIZE]; // wall values only byte tilemap[MAPSIZE][MAPSIZE]; // wall values only
byte spotvis[MAPSIZE][MAPSIZE]; byte spotvis[MAPSIZE][MAPSIZE];
objtype *actorat[MAPSIZE][MAPSIZE]; int actorat[MAPSIZE][MAPSIZE];
int tics; int tics;
...@@ -778,13 +778,18 @@ void InitActorList() ...@@ -778,13 +778,18 @@ void InitActorList()
void GetNewActor() void GetNewActor()
{ {
int id;
if (!objfreelist) if (!objfreelist)
Quit("GetNewActor: No free spots in objlist!"); Quit("GetNewActor: No free spots in objlist!");
new = objfreelist; new = objfreelist;
id = new->id;
objfreelist = new->prev; objfreelist = new->prev;
memset(new, 0, sizeof(*new)); memset(new, 0, sizeof(*new));
new->id = id;
if (lastobj) if (lastobj)
lastobj->next = new; lastobj->next = new;
new->prev = lastobj; // new->next is already NULL from memset new->prev = lastobj; // new->next is already NULL from memset
...@@ -817,7 +822,7 @@ static void RemoveObj(objtype *gone) ...@@ -817,7 +822,7 @@ static void RemoveObj(objtype *gone)
// fix the next object's back link // fix the next object's back link
// //
if (gone == lastobj) if (gone == lastobj)
lastobj = (objtype *)gone->prev; lastobj = gone->prev;
else else
gone->next->prev = gone->prev; gone->next->prev = gone->prev;
...@@ -1113,7 +1118,7 @@ void DoActor(objtype *ob) ...@@ -1113,7 +1118,7 @@ void DoActor(objtype *ob)
if ((ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley]) if ((ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley])
return; return;
actorat[ob->tilex][ob->tiley] = ob; actorat[ob->tilex][ob->tiley] = ob->id | 0x8000;
return; return;
} }
...@@ -1172,7 +1177,7 @@ think: ...@@ -1172,7 +1177,7 @@ think:
if ((ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley]) if ((ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley])
return; return;
actorat[ob->tilex][ob->tiley] = ob; actorat[ob->tilex][ob->tiley] = ob->id | 0x8000;
} }
//========================================================================== //==========================================================================
......
...@@ -58,7 +58,7 @@ void SpawnNewObj(unsigned tilex, unsigned tiley, int state) /* stateenum */ ...@@ -58,7 +58,7 @@ void SpawnNewObj(unsigned tilex, unsigned tiley, int state) /* stateenum */
new->y = ((long)tiley<<TILESHIFT)+TILEGLOBAL/2; new->y = ((long)tiley<<TILESHIFT)+TILEGLOBAL/2;
new->dir = nodir; new->dir = nodir;
actorat[tilex][tiley] = new; actorat[tilex][tiley] = new->id | 0x8000;
new->areanumber = new->areanumber =
*(mapsegs[0] + farmapylookup[new->tiley]+new->tilex) - AREATILE; *(mapsegs[0] + farmapylookup[new->tiley]+new->tilex) - AREATILE;
} }
...@@ -113,27 +113,27 @@ void NewState(objtype *ob, int state) /* stateenum */ ...@@ -113,27 +113,27 @@ void NewState(objtype *ob, int state) /* stateenum */
*/ */
#define CHECKDIAG(x,y) \ #define CHECKDIAG(x,y) \
{ \ { \
temp=(unsigned)actorat[x][y]; \ temp = actorat[x][y]; \
if (temp) \ if (temp) \
{ \ { \
if (temp<256) \ if (temp < 256) \
return false; \ return false; \
if (((objtype *)temp)->flags&FL_SHOOTABLE) \ if (objlist[temp & ~0x8000].flags & FL_SHOOTABLE) \
return false; \ return false; \
} \ } \
} }
#define CHECKSIDE(x,y) \ #define CHECKSIDE(x,y) \
{ \ { \
temp=(unsigned)actorat[x][y]; \ temp = actorat[x][y]; \
if (temp) \ if (temp) \
{ \ { \
if (temp<128) \ if (temp < 128) \
return false; \ return false; \
if (temp<256) \ if (temp < 256) \
doornum = temp&63; \ doornum = temp&63; \
else if (((objtype *)temp)->flags&FL_SHOOTABLE)\ else if (objlist[temp & ~0x8000].flags & FL_SHOOTABLE) \
return false; \ return false; \
} \ } \
} }
...@@ -863,7 +863,7 @@ void KillActor (objtype *ob) ...@@ -863,7 +863,7 @@ void KillActor (objtype *ob)
gamestate.killcount++; gamestate.killcount++;
ob->flags &= ~FL_SHOOTABLE; ob->flags &= ~FL_SHOOTABLE;
actorat[ob->tilex][ob->tiley] = NULL; actorat[ob->tilex][ob->tiley] = 0;
ob->flags |= FL_NONMARK; ob->flags |= FL_NONMARK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment