SW de-shortification

This commit is contained in:
Christoph Oelckers 2021-11-21 21:47:37 +01:00
parent 4d7b45b68e
commit 6a9b377724
16 changed files with 103 additions and 180 deletions

View file

@ -1,20 +1,15 @@
BEGIN_SW_NS BEGIN_SW_NS
bool FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum); bool FindCeilingView(int match, int* x, int* y, int z, int* sectnum);
bool FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum); bool FindFloorView(int match, int* x, int* y, int z, int* sectnum);
short int ViewSectorInScene(int cursectnum, int level)
ViewSectorInScene(short cursectnum, short level)
{ {
int i;
SPRITEp sp;
short match;
SWStatIterator it(STAT_FAF); SWStatIterator it(STAT_FAF);
while (auto actor = it.Next()) while (auto actor = it.Next())
{ {
sp = &actor->s(); auto sp = &actor->s();
if (sp->hitag == level) if (sp->hitag == level)
{ {
@ -27,7 +22,7 @@ ViewSectorInScene(short cursectnum, short level)
// only gets to here is sprite is pointing down // only gets to here is sprite is pointing down
// found a potential match // found a potential match
match = sp->lotag; int match = sp->lotag;
if (!testgotpic(FAF_MIRROR_PIC, true)) if (!testgotpic(FAF_MIRROR_PIC, true))
return -1; return -1;
@ -41,15 +36,11 @@ ViewSectorInScene(short cursectnum, short level)
void void DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, int tsectnum)
DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, short tsectnum)
{ {
short i;
short match;
save.zcount = 0; save.zcount = 0;
match = ViewSectorInScene(tsectnum, VIEW_LEVEL1); int match = ViewSectorInScene(tsectnum, VIEW_LEVEL1);
if (match != -1) if (match != -1)
{ {
FindCeilingView(match, &tx, &ty, tz, &tsectnum); FindCeilingView(match, &tx, &ty, tz, &tsectnum);
@ -60,7 +51,7 @@ DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, shor
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum, false); renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum, false);
// reset Z's // reset Z's
for (i = 0; i < save.zcount; i++) for (int i = 0; i < save.zcount; i++)
{ {
sector[save.sectnum[i]].floorz = save.zval[i]; sector[save.sectnum[i]].floorz = save.zval[i];
sector[save.sectnum[i]].floorpicnum = save.pic[i]; sector[save.sectnum[i]].floorpicnum = save.pic[i];
@ -74,7 +65,7 @@ DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, shor
} }
else else
{ {
match = ViewSectorInScene(tsectnum, VIEW_LEVEL2); int match = ViewSectorInScene(tsectnum, VIEW_LEVEL2);
if (match != -1) if (match != -1)
{ {
FindFloorView(match, &tx, &ty, tz, &tsectnum); FindFloorView(match, &tx, &ty, tz, &tsectnum);
@ -85,7 +76,7 @@ DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, shor
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum, false); renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum, false);
// reset Z's // reset Z's
for (i = 0; i < save.zcount; i++) for (int i = 0; i < save.zcount; i++)
{ {
sector[save.sectnum[i]].ceilingz = save.zval[i]; sector[save.sectnum[i]].ceilingz = save.zval[i];
sector[save.sectnum[i]].ceilingpicnum = save.pic[i]; sector[save.sectnum[i]].ceilingpicnum = save.pic[i];
@ -100,7 +91,7 @@ DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz, shor
} }
} }
void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, short sectnum) void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, int sectnum)
{ {
SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE); SWStatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while (auto actor = it.Next()) while (auto actor = it.Next())
@ -243,7 +234,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
{ {
SPRITEp sp=nullptr; SPRITEp sp=nullptr;
int camhoriz; int camhoriz;
short w; int w;
int dx, dy, dz, tdx, tdy, tdz, midx, midy; int dx, dy, dz, tdx, tdy, tdz, midx, midy;
@ -255,8 +246,8 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
w = mirror[cnt].mirrorwall; w = mirror[cnt].mirrorwall;
// Get wall midpoint for offset in mirror view // Get wall midpoint for offset in mirror view
midx = (wall[w].x + wall[wall[w].point2].x) / 2; midx = (wall[w].x + wall[w].point2Wall()->x) / 2;
midy = (wall[w].y + wall[wall[w].point2].y) / 2; midy = (wall[w].y + wall[w].point2Wall()->y) / 2;
// Finish finding offsets // Finish finding offsets
tdx = abs(midx - tx); tdx = abs(midx - tx);

View file

@ -992,7 +992,7 @@ int DoActorMoveCloser(DSWActor* actor)
*/ */
short FindTrackToPlayer(DSWActor* actor) int FindTrackToPlayer(DSWActor* actor)
{ {
auto u = actor->u(); auto u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
@ -1031,8 +1031,6 @@ short FindTrackToPlayer(DSWActor* actor)
BIT(TT_SCAN) BIT(TT_SCAN)
}; };
//MONO_PRINT("FindTrackToPlayer\n");
zdiff = ActorUpper(u->targetActor) - (sp->z - SPRITEp_SIZE_Z(sp) + Z(8)); zdiff = ActorUpper(u->targetActor) - (sp->z - SPRITEp_SIZE_Z(sp) + Z(8));
if (labs(zdiff) <= Z(20)) if (labs(zdiff) <= Z(20))
@ -1065,9 +1063,6 @@ short FindTrackToPlayer(DSWActor* actor)
u->track_dir = track_dir; u->track_dir = track_dir;
SET(Track[track].flags, TF_TRACK_OCCUPIED); SET(Track[track].flags, TF_TRACK_OCCUPIED);
////DSPRINTF(ds, "Found Track To Player\n");
//MONO_PRINT(ds);
return track; return track;
} }
} }
@ -1078,7 +1073,7 @@ short FindTrackToPlayer(DSWActor* actor)
short FindTrackAwayFromPlayer(DSWActor* actor) int FindTrackAwayFromPlayer(DSWActor* actor)
{ {
auto u = actor->u(); auto u = actor->u();
int point, track_dir, track; int point, track_dir, track;
@ -1098,8 +1093,6 @@ short FindTrackAwayFromPlayer(DSWActor* actor)
BIT(TT_SCAN) BIT(TT_SCAN)
}; };
//MONO_PRINT("FindTrackAwayFromPlayer\n");
for (i = 0; i < SIZ(RunAwayTracks); i++) for (i = 0; i < SIZ(RunAwayTracks); i++)
{ {
track = ActorFindTrack(actor, -1, RunAwayTracks[i], &point, &track_dir); track = ActorFindTrack(actor, -1, RunAwayTracks[i], &point, &track_dir);
@ -1110,12 +1103,8 @@ short FindTrackAwayFromPlayer(DSWActor* actor)
u->track_dir = track_dir; u->track_dir = track_dir;
SET(Track[track].flags, TF_TRACK_OCCUPIED); SET(Track[track].flags, TF_TRACK_OCCUPIED);
////DSPRINTF(ds, "Found Run Away Track\n");
//MONO_PRINT(ds);
return track; return track;
} }
//MONO_PRINT("Did not find a run away track!\n");
} }
return -1; return -1;
@ -1123,7 +1112,7 @@ short FindTrackAwayFromPlayer(DSWActor* actor)
} }
short FindWanderTrack(DSWActor* actor) int FindWanderTrack(DSWActor* actor)
{ {
auto u = actor->u(); auto u = actor->u();
int point, track_dir, track; int point, track_dir, track;
@ -1305,7 +1294,7 @@ int DoActorAttack(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
short rand_num; int rand_num;
int dist,a,b,c; int dist,a,b,c;
DoActorNoise(ChooseAction(u->Personality->Broadcast),actor); DoActorNoise(ChooseAction(u->Personality->Broadcast),actor);
@ -1415,9 +1404,7 @@ int InitActorDuck(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
short dist; int dist;
// MONO_PRINT(strcpy(ds, "Init Actor Duck"));
if (!u->ActorActionSet->Duck) if (!u->ActorActionSet->Duck)
{ {
@ -1482,7 +1469,7 @@ int DoActorMoveJump(DSWActor* actor)
} }
Collision move_scan(DSWActor* actor, short ang, int dist, int *stopx, int *stopy, int *stopz, short *stopsect) Collision move_scan(DSWActor* actor, int ang, int dist, int *stopx, int *stopy, int *stopz, int *stopsect)
{ {
USERp u = actor->u(); USERp u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
@ -1490,7 +1477,7 @@ Collision move_scan(DSWActor* actor, short ang, int dist, int *stopx, int *stopy
int nx,ny; int nx,ny;
uint32_t cliptype = CLIPMASK_ACTOR; uint32_t cliptype = CLIPMASK_ACTOR;
short sang,ss; int sang,ss;
int x, y, z, loz, hiz; int x, y, z, loz, hiz;
DSWActor* highActor; DSWActor* highActor;
DSWActor* lowActor; DSWActor* lowActor;
@ -1555,7 +1542,7 @@ int FindNewAngle(DSWActor* actor, int dir, int DistToMove)
USERp u = actor->u(); USERp u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
static short toward_angle_delta[4][9] = static const int16_t toward_angle_delta[4][9] =
{ {
{ -160, -384, 160, 384, -256, 256, -512, 512, -99}, { -160, -384, 160, 384, -256, 256, -512, 512, -99},
{ -384, -160, 384, 160, -256, 256, -512, 512, -99}, { -384, -160, 384, 160, -256, 256, -512, 512, -99},
@ -1563,7 +1550,7 @@ int FindNewAngle(DSWActor* actor, int dir, int DistToMove)
{ 384, 160, -384, -160, 256, -256, 512, -512, -99} { 384, 160, -384, -160, 256, -256, 512, -512, -99}
}; };
static short away_angle_delta[4][8] = static const int16_t away_angle_delta[4][8] =
{ {
{ -768, 768, -640, 640, -896, 896, 1024, -99}, { -768, 768, -640, 640, -896, 896, 1024, -99},
{ 768, -768, 640, -640, -896, 896, 1024, -99}, { 768, -768, 640, -640, -896, 896, 1024, -99},
@ -1572,14 +1559,14 @@ int FindNewAngle(DSWActor* actor, int dir, int DistToMove)
}; };
int16_t* adp = nullptr; const int16_t* adp = nullptr;
short new_ang, oang; int new_ang, oang;
short save_ang = -1; int save_ang = -1;
int set; int set;
int dist, stopx, stopy, stopz; int dist, stopx, stopy, stopz;
short stopsect; int stopsect;
// start out with mininum distance that will be accepted as a move // start out with mininum distance that will be accepted as a move
int save_dist = 500; int save_dist = 500;
@ -1691,7 +1678,7 @@ int InitActorReposition(DSWActor* actor)
{ {
USER* u = actor->u(); USER* u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
short ang; int ang;
int rnum; int rnum;
int dist; int dist;

View file

@ -32,7 +32,7 @@ BEGIN_SW_NS
// Call functions based on a random range value // Call functions based on a random range value
typedef struct typedef struct
{ {
short range; int range;
ANIMATORp action; ANIMATORp action;
} DECISION, *DECISIONp; } DECISION, *DECISIONp;
@ -61,7 +61,7 @@ typedef enum
struct ATTRIBUTEstruct struct ATTRIBUTEstruct
{ {
short Speed[MAX_SPEED]; int16_t Speed[MAX_SPEED];
int8_t TicAdjust[MAX_SPEED]; int8_t TicAdjust[MAX_SPEED];
uint8_t MaxWeapons; uint8_t MaxWeapons;
/*ATTRIB_SNDS*/ int Sounds[MAXATTRIBSNDS]; // JBF: ATTRIB_SNDS? Somehow I don't think this is what was intended... /*ATTRIB_SNDS*/ int Sounds[MAXATTRIBSNDS]; // JBF: ATTRIB_SNDS? Somehow I don't think this is what was intended...
@ -90,8 +90,8 @@ int InitActorExtra6Noise(DSWActor* actor);
int InitActorMoveCloser(DSWActor* actor); int InitActorMoveCloser(DSWActor* actor);
int DoActorCantMoveCloser(DSWActor* actor); int DoActorCantMoveCloser(DSWActor* actor);
int DoActorMoveCloser(DSWActor* actor); int DoActorMoveCloser(DSWActor* actor);
short FindTrackToPlayer(DSWActor* actor); int FindTrackToPlayer(DSWActor* actor);
short FindTrackAwayFromPlayer(DSWActor* actor); int FindTrackAwayFromPlayer(DSWActor* actor);
int InitActorRunAway(DSWActor* actor); int InitActorRunAway(DSWActor* actor);
int InitActorRunToward(DSWActor* actor); int InitActorRunToward(DSWActor* actor);
int InitActorAttack(DSWActor* actor); int InitActorAttack(DSWActor* actor);

View file

@ -65,12 +65,12 @@ struct NODETREEstruct
// Bots main action variables // Bots main action variables
typedef struct BOT_BRAIN typedef struct BOT_BRAIN
{ {
short tgt_inv; // Inventory item it wants to use int16_t tgt_inv; // Inventory item it wants to use
short tgt_weapon; // weapon in wants to activate and use int16_t tgt_weapon; // weapon in wants to activate and use
short tgt_enemy; // Enemy it wants to kill int16_t tgt_enemy; // Enemy it wants to kill
short tgt_sprite; // Sprite it wants to pickup or operate int16_t tgt_sprite; // Sprite it wants to pickup or operate
short tgt_sector; // Sector it wants to get to int16_t tgt_sector; // Sector it wants to get to
short tgt_wall; // Wall it wants to touch int16_t tgt_wall; // Wall it wants to touch
BOT_Actions action; // Bot's current action BOT_Actions action; // Bot's current action
} BotBrain, *BotBrain_p; } BotBrain, *BotBrain_p;

View file

@ -39,8 +39,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
static int SectorOfWall(short theline); static int SectorOfWall(int theline);
static void DoWallBreakSpriteMatch(short match); static void DoWallBreakSpriteMatch(int match);
BREAK_INFO WallBreakInfo[] = BREAK_INFO WallBreakInfo[] =
{ {
@ -441,18 +441,18 @@ static int CompareBreakInfo(void const * a, void const * b)
return break_info1->picnum - break_info2->picnum; return break_info1->picnum - break_info2->picnum;
} }
int CompareSearchBreakInfo(short *picnum, BREAK_INFOp break_info) int CompareSearchBreakInfo(int *picnum, BREAK_INFOp break_info)
{ {
// will return a number less than 0 if picnum < break_info->picnum // will return a number less than 0 if picnum < break_info->picnum
return(*picnum - break_info->picnum); return(*picnum - break_info->picnum);
} }
BREAK_INFOp FindWallBreakInfo(short picnum) BREAK_INFOp FindWallBreakInfo(int picnum)
{ {
return(BREAK_INFOp)(bsearch(&picnum, &WallBreakInfo, SIZ(WallBreakInfo), sizeof(BREAK_INFO), (int(*)(const void*,const void*))CompareSearchBreakInfo)); return(BREAK_INFOp)(bsearch(&picnum, &WallBreakInfo, SIZ(WallBreakInfo), sizeof(BREAK_INFO), (int(*)(const void*,const void*))CompareSearchBreakInfo));
} }
BREAK_INFOp FindSpriteBreakInfo(short picnum) BREAK_INFOp FindSpriteBreakInfo(int picnum)
{ {
return(BREAK_INFOp)(bsearch(&picnum, &SpriteBreakInfo, SIZ(SpriteBreakInfo), sizeof(BREAK_INFO), (int(*)(const void*,const void*))CompareSearchBreakInfo)); return(BREAK_INFOp)(bsearch(&picnum, &SpriteBreakInfo, SIZ(SpriteBreakInfo), sizeof(BREAK_INFO), (int(*)(const void*,const void*))CompareSearchBreakInfo));
} }
@ -494,7 +494,7 @@ BREAK_INFOp SetupWallForBreak(WALLp wallp)
BREAK_INFOp SetupSpriteForBreak(DSWActor* actor) BREAK_INFOp SetupSpriteForBreak(DSWActor* actor)
{ {
auto sp = &actor->s(); auto sp = &actor->s();
short picnum = sp->picnum; int picnum = sp->picnum;
BREAK_INFOp break_info; BREAK_INFOp break_info;
// ignore as a breakable if true // ignore as a breakable if true
@ -532,7 +532,7 @@ BREAK_INFOp SetupSpriteForBreak(DSWActor* actor)
// ACTIVATE // ACTIVATE
////////////////////////////////////////////// //////////////////////////////////////////////
DSWActor* FindBreakSpriteMatch(short match) DSWActor* FindBreakSpriteMatch(int match)
{ {
SWStatIterator it(STAT_BREAKABLE); SWStatIterator it(STAT_BREAKABLE);
while (auto actor = it.Next()) while (auto actor = it.Next())
@ -551,7 +551,7 @@ DSWActor* FindBreakSpriteMatch(short match)
// WALL // WALL
// //
int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short type) int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, int ang, int type)
{ {
BREAK_INFOp break_info; BREAK_INFOp break_info;
WALLp nwp; WALLp nwp;
@ -641,9 +641,9 @@ int AutoBreakWall(WALLp wallp, int hit_x, int hit_y, int hit_z, short ang, short
return true; return true;
} }
bool UserBreakWall(WALLp wp, short) bool UserBreakWall(WALLp wp)
{ {
short match = wp->hitag; int match = wp->hitag;
int block_flags = CSTAT_WALL_BLOCK|CSTAT_WALL_BLOCK_HITSCAN; int block_flags = CSTAT_WALL_BLOCK|CSTAT_WALL_BLOCK_HITSCAN;
int type_flags = CSTAT_WALL_TRANSLUCENT|CSTAT_WALL_MASKED|CSTAT_WALL_1WAY; int type_flags = CSTAT_WALL_TRANSLUCENT|CSTAT_WALL_MASKED|CSTAT_WALL_1WAY;
int flags = block_flags|type_flags; int flags = block_flags|type_flags;
@ -730,12 +730,12 @@ bool UserBreakWall(WALLp wp, short)
return false; return false;
} }
int WallBreakPosition(short hit_wall, int *sectnum, int *x, int *y, int *z, short *ang) int WallBreakPosition(int hit_wall, int *sectnum, int *x, int *y, int *z, int *ang)
{ {
short w,nw; int w,nw;
WALLp wp; WALLp wp;
int nx,ny; int nx,ny;
short wall_ang; int wall_ang;
w = hit_wall; w = hit_wall;
wp = &wall[w]; wp = &wall[w];
@ -752,29 +752,29 @@ int WallBreakPosition(short hit_wall, int *sectnum, int *x, int *y, int *z, shor
//getzsofsector(*sectnum, *x, *y, cz, fz); //getzsofsector(*sectnum, *x, *y, cz, fz);
if (wp->nextwall < 0) if (!wp->twoSided())
{ {
// white wall // white wall
*z = DIV2(sector[*sectnum].floorz + sector[*sectnum].ceilingz); *z = DIV2(sector[*sectnum].floorz + sector[*sectnum].ceilingz);
} }
else else
{ {
short next_sectnum = wp->nextsector; auto next_sect = wp->nextSector();
// red wall // red wall
ASSERT(wp->nextsector >= 0); ASSERT(wp->nextsector >= 0);
// floor and ceiling meet // floor and ceiling meet
if (sector[next_sectnum].floorz == sector[next_sectnum].ceilingz) if (next_sect->floorz == next_sect->ceilingz)
*z = DIV2(sector[*sectnum].floorz + sector[*sectnum].ceilingz); *z = (sector[*sectnum].floorz + sector[*sectnum].ceilingz) >> 1;
else else
// floor is above other sector // floor is above other sector
if (sector[next_sectnum].floorz < sector[*sectnum].floorz) if (next_sect->floorz < sector[*sectnum].floorz)
*z = DIV2(sector[next_sectnum].floorz + sector[*sectnum].floorz); *z = (next_sect->floorz + sector[*sectnum].floorz) >> 1;
else else
// ceiling is below other sector // ceiling is below other sector
if (sector[next_sectnum].ceilingz > sector[*sectnum].ceilingz) if (next_sect->ceilingz > sector[*sectnum].ceilingz)
*z = DIV2(sector[next_sectnum].ceilingz + sector[*sectnum].ceilingz); *z = (next_sect->ceilingz + sector[*sectnum].ceilingz) >> 1;
} }
*ang = wall_ang; *ang = wall_ang;
@ -796,13 +796,13 @@ int WallBreakPosition(short hit_wall, int *sectnum, int *x, int *y, int *z, shor
} }
// If the tough parameter is not set, then it can't break tough walls and sprites // If the tough parameter is not set, then it can't break tough walls and sprites
bool HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short type) bool HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, int ang, int type)
{ {
short match = wp->hitag; int match = wp->hitag;
if (match > 0) if (match > 0)
{ {
UserBreakWall(wp, ang); UserBreakWall(wp);
return true; return true;
} }
@ -855,8 +855,8 @@ int UserBreakSprite(DSWActor* breakActor)
{ {
SPRITEp sp; SPRITEp sp;
SPRITEp bp = &breakActor->s(); SPRITEp bp = &breakActor->s();
short match = bp->lotag; int match = bp->lotag;
short match_extra; int match_extra;
auto actor = FindBreakSpriteMatch(match); auto actor = FindBreakSpriteMatch(match);
@ -924,11 +924,10 @@ int UserBreakSprite(DSWActor* breakActor)
return false; return false;
} }
int AutoBreakSprite(DSWActor* breakActor, short type) int AutoBreakSprite(DSWActor* breakActor, int type)
{ {
SPRITEp bp = &breakActor->s(); SPRITEp bp = &breakActor->s();
BREAK_INFOp break_info; BREAK_INFOp break_info;
extern void DoWallBreakMatch(short match);
break_info = FindSpriteBreakInfo(bp->picnum); break_info = FindSpriteBreakInfo(bp->picnum);
@ -1011,7 +1010,7 @@ bool NullActor(DSWActor* actor)
return false; return false;
} }
int HitBreakSprite(DSWActor* breakActor, short type) int HitBreakSprite(DSWActor* breakActor, int type)
{ {
SPRITEp bp = &breakActor->s(); SPRITEp bp = &breakActor->s();
USERp bu = breakActor->u(); USERp bu = breakActor->u();
@ -1038,48 +1037,32 @@ int HitBreakSprite(DSWActor* breakActor, short type)
return AutoBreakSprite(breakActor, type); return AutoBreakSprite(breakActor, type);
} }
static int SectorOfWall(short theline) static int SectorOfWall(int theline)
{ {
short i, startwall, endwall, sectnum; return wall[theline].sector;
sectnum = -1;
for (i=0; i<numsectors; i++)
{
startwall = sector[i].wallptr;
endwall = startwall + sector[i].wallnum - 1;
if ((theline >= startwall) && (theline <= endwall))
{
sectnum = i;
break;
}
}
return sectnum;
} }
void DoWallBreakMatch(short match) void DoWallBreakMatch(int match)
{ {
int i,sectnum; int i,sectnum;
int x,y,z; int x,y,z;
WALLp wp; WALLp wp;
short wall_ang; int wall_ang;
for (i=0; i<=numwalls; i++) for (i=0; i<=numwalls; i++)
{ {
if (wall[i].hitag == match) if (wall[i].hitag == match)
{ {
WallBreakPosition(i, &sectnum, &x, &y, &z, &wall_ang); WallBreakPosition(i, &sectnum, &x, &y, &z, &wall_ang);
//short nw = wall[i].point2;
//wall_ang = NORM_ANGLE(getangle(wall[nw].x - wall[i].x, wall[nw].y - wall[i].y)+512); wp = &wall[i];
wp = &wall[i];
wp->hitag = 0; // Reset the hitag wp->hitag = 0; // Reset the hitag
AutoBreakWall(wp, x, y, z, wall_ang, 0); AutoBreakWall(wp, x, y, z, wall_ang, 0);
} }
} }
} }
static void DoWallBreakSpriteMatch(short match) static void DoWallBreakSpriteMatch(int match)
{ {
SWStatIterator it(STAT_ENEMY); SWStatIterator it(STAT_ENEMY);
while (auto actor = it.Next()) while (auto actor = it.Next())

View file

@ -41,20 +41,20 @@ enum
typedef struct BREAK_INFO typedef struct BREAK_INFO
{ {
short picnum, breaknum, shrap_type; int16_t picnum, breaknum, shrap_type;
short flags, shrap_amt; int16_t flags, shrap_amt;
} *BREAK_INFOp; } *BREAK_INFOp;
BREAK_INFOp FindWallBreakInfo(short picnum); BREAK_INFOp FindWallBreakInfo(int picnum);
BREAK_INFOp FindSpriteBreakInfo(short picnum); BREAK_INFOp FindSpriteBreakInfo(int picnum);
void SortBreakInfo(void); void SortBreakInfo(void);
BREAK_INFOp SetupWallForBreak(WALLp wallp); BREAK_INFOp SetupWallForBreak(WALLp wallp);
BREAK_INFOp SetupSpriteForBreak(DSWActor* actor); BREAK_INFOp SetupSpriteForBreak(DSWActor* actor);
bool HitBreakWall(WALLp wp, int, int, int, short ang, short type); bool HitBreakWall(WALLp wp, int, int, int, int ang, int type);
int HitBreakSprite(short BreakSprite, short type); bool CheckBreakToughness(BREAK_INFOp break_info, int ID);
bool CheckBreakToughness(BREAK_INFOp break_info, short ID); int WallBreakPosition(int hit_wall, int *sectnum, int *x, int *y, int *z, int *ang);
int WallBreakPosition(short hit_wall, int *sectnum, int *x, int *y, int *z, short *ang);
void SortBreakInfo(void); void SortBreakInfo(void);
void DoWallBreakMatch(int match);
END_SW_NS END_SW_NS

View file

@ -841,7 +841,7 @@ int DoBunnyBeginJumpAttack(DSWActor* actor)
USER* u = actor->u(); USER* u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
SPRITEp psp = &u->targetActor->s(); SPRITEp psp = &u->targetActor->s();
short tang; int tang;
tang = getangle(psp->x - sp->x, psp->y - sp->y); tang = getangle(psp->x - sp->x, psp->y - sp->y);
@ -1149,7 +1149,7 @@ void BunnyHatch(DSWActor* actor)
SPRITEp np; SPRITEp np;
USERp nu; USERp nu;
const int MAX_BUNNYS = 1; const int MAX_BUNNYS = 1;
short rip_ang[MAX_BUNNYS]; int16_t rip_ang[MAX_BUNNYS];
rip_ang[0] = RANDOM_P2(2048); rip_ang[0] = RANDOM_P2(2048);

View file

@ -32,10 +32,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
short f_c = 3; int f_c = 3;
void void
MapColors(short num, COLOR_MAP cm, short create, uint8_t *tempbuf) MapColors(int num, COLOR_MAP cm, int create, uint8_t *tempbuf)
{ {
int i; int i;
float inc; float inc;
@ -212,7 +212,7 @@ void GameInterface::loadPalette(void)
static COLOR_MAP MenuHighlight = {16, 16, RED, FIRE}; static COLOR_MAP MenuHighlight = {16, 16, RED, FIRE};
unsigned int i; unsigned int i;
short play; int play;
uint8_t tempbuf[256]; uint8_t tempbuf[256];
paletteLoadFromDisk(); paletteLoadFromDisk();

View file

@ -544,8 +544,6 @@ int SetupCoolg(DSWActor* actor)
return 0; return 0;
} }
extern short TotalKillable;
int NewCoolg(DSWActor* actor) int NewCoolg(DSWActor* actor)
{ {
USERp u = actor->u(); USERp u = actor->u();

View file

@ -341,41 +341,6 @@ STATEp sg_CoolieDead[] =
s_CoolieDead s_CoolieDead
}; };
/*
typedef struct
{
#define MAX_ACTOR_CLOSE_ATTACK 2
#define MAX_ACTOR_ATTACK 6
STATEp *Stand;
STATEp *Run;
STATEp *Jump;
STATEp *Fall;
STATEp *Crawl;
STATEp *Swim;
STATEp *Fly;
STATEp *Rise;
STATEp *Sit;
STATEp *Look;
STATEp *Climb;
STATEp *Pain;
STATEp *Death1;
STATEp *Death2;
STATEp *Dead;
STATEp *DeathJump;
STATEp *DeathFall;
STATEp *CloseAttack[MAX_ACTOR_CLOSE_ATTACK];
short CloseAttackPercent[MAX_ACTOR_CLOSE_ATTACK];
STATEp *Attack[MAX_ACTOR_ATTACK];
short AttackPercent[MAX_ACTOR_ATTACK];
STATEp *Special[2];
STATEp *Duck;
STATEp *Dive;
}ACTOR_ACTION_SET,*ACTOR_ACTION_SETp;
*/
ACTOR_ACTION_SET CoolieActionSet = ACTOR_ACTION_SET CoolieActionSet =
{ {
sg_CoolieStand, sg_CoolieStand,
@ -410,10 +375,9 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp perso
USERp u = actor->u(); USERp u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
unsigned int wpn; unsigned int wpn;
short wpn_cnt; int wpn_cnt;
short depth = 0; int depth = 0;
extern short TotalKillable;
switch (u->ID) switch (u->ID)
{ {
case PACHINKO1: case PACHINKO1:

View file

@ -66,7 +66,7 @@ static int OverlapDraw = false;
extern bool QuitFlag, SpriteInfo; extern bool QuitFlag, SpriteInfo;
extern bool Voxel; extern bool Voxel;
bool DrawScreen; bool DrawScreen;
extern short f_c; extern int f_c;
extern ParentalStruct aVoxelArray[MAXTILES]; extern ParentalStruct aVoxelArray[MAXTILES];

View file

@ -106,7 +106,7 @@ short screenpeek = 0;
int GodMode = false; int GodMode = false;
short Skill = 2; short Skill = 2;
short TotalKillable; int TotalKillable;
const GAME_SET gs_defaults = const GAME_SET gs_defaults =
{ {

View file

@ -2113,7 +2113,7 @@ int32_t registerosdcommands(void);
void SW_InitMultiPsky(void); void SW_InitMultiPsky(void);
extern short LevelSecrets; extern short LevelSecrets;
extern short TotalKillable; extern int TotalKillable;
extern int OrigCommPlayers; extern int OrigCommPlayers;
extern uint8_t PlayerGravity; extern uint8_t PlayerGravity;

View file

@ -86,8 +86,8 @@ static void processWeapon(PLAYERp const pp)
if (loc.getNewWeapon() == WeaponSel_Next) if (loc.getNewWeapon() == WeaponSel_Next)
{ {
short next_weapon = u->WeaponNum + 1; int next_weapon = u->WeaponNum + 1;
short start_weapon; int start_weapon;
start_weapon = u->WeaponNum + 1; start_weapon = u->WeaponNum + 1;
@ -121,8 +121,8 @@ static void processWeapon(PLAYERp const pp)
} }
else if (loc.getNewWeapon() == WeaponSel_Prev) else if (loc.getNewWeapon() == WeaponSel_Prev)
{ {
short prev_weapon = u->WeaponNum - 1; int prev_weapon = u->WeaponNum - 1;
short start_weapon; int start_weapon;
start_weapon = u->WeaponNum - 1; start_weapon = u->WeaponNum - 1;
@ -153,7 +153,7 @@ static void processWeapon(PLAYERp const pp)
} }
else if (loc.getNewWeapon() == WeaponSel_Alt) else if (loc.getNewWeapon() == WeaponSel_Alt)
{ {
short const which_weapon = u->WeaponNum + 1; int which_weapon = u->WeaponNum + 1;
loc.setNewWeapon(which_weapon); loc.setNewWeapon(which_weapon);
} }
} }

View file

@ -728,7 +728,7 @@ void GetUpperLowerSector(short match, int x, int y, short *upper, short *lower)
} }
} }
bool FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum) bool FindCeilingView(int match, int* x, int* y, int z, int* sectnum)
{ {
int xoff = 0; int xoff = 0;
int yoff = 0; int yoff = 0;
@ -823,7 +823,7 @@ bool FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* se
return true; return true;
} }
bool FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum) bool FindFloorView(int match, int* x, int* y, int z, int* sectnum)
{ {
int xoff = 0; int xoff = 0;
int yoff = 0; int yoff = 0;
@ -1023,7 +1023,7 @@ void CollectPortals()
int tx = actor->s().x; int tx = actor->s().x;
int ty = actor->s().y; int ty = actor->s().y;
int tz = actor->s().z; int tz = actor->s().z;
int16_t tsectnum = sec; int tsectnum = sec;
int match = FindViewSectorInScene(tsectnum, VIEW_LEVEL1); int match = FindViewSectorInScene(tsectnum, VIEW_LEVEL1);
if (match != -1) if (match != -1)
@ -1053,7 +1053,7 @@ void CollectPortals()
int tx = actor->s().x; int tx = actor->s().x;
int ty = actor->s().y; int ty = actor->s().y;
int tz = actor->s().z; int tz = actor->s().z;
int16_t tsectnum = sec; int tsectnum = sec;
int match = FindViewSectorInScene(tsectnum, VIEW_LEVEL2); int match = FindViewSectorInScene(tsectnum, VIEW_LEVEL2);
if (match != -1) if (match != -1)

View file

@ -7313,7 +7313,7 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in
short break_count; short break_count;
int sectnum; int sectnum;
short wall_ang; int wall_ang;
int hit_x,hit_y,hit_z; int hit_x,hit_y,hit_z;
@ -19515,7 +19515,7 @@ int ShrapKillSprite(DSWActor* actor)
return 0; return 0;
} }
bool CheckBreakToughness(BREAK_INFOp break_info, short ID) bool CheckBreakToughness(BREAK_INFOp break_info, int ID)
{ {
////DSPRINTF(ds,"CheckBreakToughness called with %d",ID); ////DSPRINTF(ds,"CheckBreakToughness called with %d",ID);
//CON_Message(ds); //CON_Message(ds);