From a92d5486c425517b5392d13705a9b6e247815399 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 14 Oct 2012 20:41:21 +0000 Subject: [PATCH] Replace all/most literal SE lotags 1/2 with SE_1_ABOVE_WATER or SE_2_UNDERWATER. Also catch some other literal SEs and statnums. git-svn-id: https://svn.eduke32.com/eduke32@3073 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 88 +++++++++++++++---------------- polymer/eduke32/source/game.c | 26 ++++----- polymer/eduke32/source/gameexec.c | 16 +++--- polymer/eduke32/source/player.c | 63 ++++++++++++---------- polymer/eduke32/source/sector.c | 9 ++-- polymer/eduke32/source/sounds.c | 5 +- 6 files changed, 107 insertions(+), 100 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 13e966276..d451298e7 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -360,16 +360,16 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) if (dasectnum < 0 || (dasectnum >= 0 && ((actor[spritenum].actorstayput >= 0 && actor[spritenum].actorstayput != dasectnum) || - ((spr->picnum == BOSS2) && spr->pal == 0 && sector[dasectnum].lotag != 3) || - ((spr->picnum == BOSS1 || spr->picnum == BOSS2) && sector[dasectnum].lotag == 1) /*|| - (sector[dasectnum].lotag == 1 && (spr->picnum == LIZMAN || (spr->picnum == LIZTROOP && spr->zvel == 0)))*/ + ((spr->picnum == BOSS2) && spr->pal == 0 && sector[dasectnum].lotag != ST_3) || + ((spr->picnum == BOSS1 || spr->picnum == BOSS2) && sector[dasectnum].lotag == ST_1_ABOVE_WATER) /*|| + (sector[dasectnum].lotag == ST_1_ABOVE_WATER && (spr->picnum == LIZMAN || (spr->picnum == LIZTROOP && spr->zvel == 0)))*/ )) ) { spr->x = oldx; spr->y = oldy; /* - if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && spr->picnum == LIZMAN) + if (dasectnum >= 0 && sector[dasectnum].lotag == ST_1_ABOVE_WATER && spr->picnum == LIZMAN) spr->ang = (krand()&2047); else if ((Actor[spritenum].t_data[0]&3) == 1 && spr->picnum != COMMANDER) spr->ang = (krand()&2047); @@ -438,7 +438,7 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) { switch (sector[dasectnum].lotag) { - case 1: + case ST_1_ABOVE_WATER: if (daz >= actor[spritenum].floorz) { if (totalclock > actor[spritenum].lasttransport) @@ -455,7 +455,7 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) return 0; } - case 2: + case ST_2_UNDERWATER: if (daz <= actor[spritenum].ceilingz) { if (totalclock > actor[spritenum].lasttransport) @@ -1024,14 +1024,14 @@ void A_MoveDummyPlayers(void) psectnum = ps->cursectnum; - if (ps->on_crane >= 0 || (psectnum >= 0 && sector[psectnum].lotag != 1) || sprite[ps->i].extra <= 0) + if (ps->on_crane >= 0 || (psectnum >= 0 && sector[psectnum].lotag != ST_1_ABOVE_WATER) || sprite[ps->i].extra <= 0) { ps->dummyplayersprite = -1; KILLIT(i); } else { - if (ps->on_ground && ps->on_warping_sector == 1 && psectnum >= 0 && sector[psectnum].lotag == 1) + if (ps->on_ground && ps->on_warping_sector == 1 && psectnum >= 0 && sector[psectnum].lotag == ST_1_ABOVE_WATER) { CS = 257; SZ = sector[SECT].ceilingz+(27<<8); @@ -1042,7 +1042,7 @@ void A_MoveDummyPlayers(void) } else { - if (sector[SECT].lotag != 2) SZ = sector[SECT].floorz; + if (sector[SECT].lotag != ST_2_UNDERWATER) SZ = sector[SECT].floorz; CS = (int16_t) 32768; } } @@ -1072,7 +1072,7 @@ ACTOR_STATIC void G_MovePlayers(void) { const int32_t nexti = nextspritestat[i]; - spritetype *s = &sprite[i]; + spritetype *const s = &sprite[i]; DukePlayer_t *const p = g_player[s->yvel].ps; if (s->owner >= 0) @@ -1193,9 +1193,9 @@ ACTOR_STATIC void G_MovePlayers(void) else { s->yrepeat = 36; - if (sector[s->sectnum].lotag != 2) + if (sector[s->sectnum].lotag != ST_2_UNDERWATER) A_Fall(i); - if (s->zvel == 0 && sector[s->sectnum].lotag == 1) + if (s->zvel == 0 && sector[s->sectnum].lotag == ST_1_ABOVE_WATER) s->z += (32<<8); } @@ -2597,7 +2597,7 @@ ACTOR_STATIC void G_MoveWeapons(void) k = s->xvel; ll = s->zvel; - if (sector[s->sectnum].lotag == 2) + if (sector[s->sectnum].lotag == ST_2_UNDERWATER) { k >>= 1; ll >>= 1; @@ -2645,16 +2645,16 @@ ACTOR_STATIC void G_MoveWeapons(void) j = 16384|(s->sectnum); s->zvel = -1; } - else if ((s->z > actor[i].floorz && sector[s->sectnum].lotag != 1) || - (s->z > actor[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1)) + else if ((s->z > actor[i].floorz && sector[s->sectnum].lotag != ST_1_ABOVE_WATER) || + (s->z > actor[i].floorz+(16<<8) && sector[s->sectnum].lotag == ST_1_ABOVE_WATER)) { j = 16384|(s->sectnum); - if (sector[s->sectnum].lotag != 1) + if (sector[s->sectnum].lotag != ST_1_ABOVE_WATER) s->zvel = 1; } } - if (proj->workslike & PROJECTILE_WATERBUBBLES && sector[s->sectnum].lotag == 2 && rnd(140)) + if (proj->workslike & PROJECTILE_WATERBUBBLES && sector[s->sectnum].lotag == ST_2_UNDERWATER && rnd(140)) A_Spawn(i,WATERBUBBLE); if (j != 0) @@ -2878,7 +2878,7 @@ ACTOR_STATIC void G_MoveWeapons(void) k = s->xvel; ll = s->zvel; - if (s->picnum == RPG && sector[s->sectnum].lotag == 2) + if (s->picnum == RPG && sector[s->sectnum].lotag == ST_2_UNDERWATER) { k >>= 1; ll >>= 1; @@ -2892,7 +2892,7 @@ ACTOR_STATIC void G_MoveWeapons(void) { case RPG__STATIC: if (DYNAMICTILEMAP(s->picnum) == RPG__STATIC && actor[i].picnum != BOSS2 && - s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) + s->xrepeat >= 10 && sector[s->sectnum].lotag != ST_2_UNDERWATER) { j = A_Spawn(i,SMALLSMOKE); sprite[j].z += (1<<8); @@ -2927,11 +2927,11 @@ ACTOR_STATIC void G_MoveWeapons(void) j = 16384|(s->sectnum); s->zvel = -1; } - else if ((s->z > actor[i].floorz && sector[s->sectnum].lotag != 1) || - (s->z > actor[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1)) + else if ((s->z > actor[i].floorz && sector[s->sectnum].lotag != ST_1_ABOVE_WATER) || + (s->z > actor[i].floorz+(16<<8) && sector[s->sectnum].lotag == ST_1_ABOVE_WATER)) { j = 16384|(s->sectnum); - if (sector[s->sectnum].lotag != 1) + if (sector[s->sectnum].lotag != ST_1_ABOVE_WATER) s->zvel = 1; } } @@ -3120,7 +3120,7 @@ COOLEXPLOSION: if (s->shade >= 40) KILLIT(i); } - else if (s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140)) + else if (s->picnum == RPG && sector[s->sectnum].lotag == ST_2_UNDERWATER && s->xrepeat >= 10 && rnd(140)) A_Spawn(i,WATERBUBBLE); goto BOLT; @@ -3309,7 +3309,7 @@ ACTOR_STATIC void G_MoveTransports(void) break; } } - else if (!(sectlotag == 1 && ps->on_ground == 1)) break; + else if (!(sectlotag == ST_1_ABOVE_WATER && ps->on_ground == 1)) break; if (onfloorz == 0 && klabs(SZ-ps->pos.z) < 6144) if ((ps->jetpack_on == 0) || (ps->jetpack_on && TEST_SYNC_KEY(g_player[p].sync->bits, SK_JUMP)) || @@ -3404,24 +3404,24 @@ ACTOR_STATIC void G_MoveTransports(void) case TOILETWATER__STATIC: case LASERLINE__STATIC: goto JBOLT; + case PLAYERONWATER__STATIC: - if (sectlotag == 2) + if (sectlotag == ST_2_UNDERWATER) { sprite[j].cstat &= 32768; break; } default: - if (sprite[j].statnum == STAT_MISC && !(sectlotag == 1 || sectlotag == 2)) + if (sprite[j].statnum == STAT_MISC && !(sectlotag == ST_1_ABOVE_WATER || sectlotag == ST_2_UNDERWATER)) break; - case WATERBUBBLE__STATIC: - // if( rnd(192) && sprite[j].picnum == WATERBUBBLE) - // break; +// if( rnd(192) && sprite[j].picnum == WATERBUBBLE) +// break; if (sectlotag > 0) { k = A_Spawn(j,WATERSPLASH2); - if (sectlotag == 1 && sprite[j].statnum == STAT_PROJECTILE) + if (sectlotag == ST_1_ABOVE_WATER && sprite[j].statnum == STAT_PROJECTILE) { sprite[k].xvel = sprite[j].xvel>>1; sprite[k].ang = sprite[j].ang; @@ -4459,16 +4459,16 @@ ACTOR_STATIC void G_MoveActors(void) { A_Fall(i); - if ((sector[sect].lotag != 1 || actor[i].floorz != sector[sect].floorz) && s->z >= actor[i].floorz-(ZOFFSET) && s->yvel < 3) + if ((sector[sect].lotag != ST_1_ABOVE_WATER || actor[i].floorz != sector[sect].floorz) && s->z >= actor[i].floorz-(ZOFFSET) && s->yvel < 3) { if (s->yvel > 0 || (s->yvel == 0 && actor[i].floorz == sector[sect].floorz)) A_PlaySound(PIPEBOMB_BOUNCE,i); s->zvel = -((4-s->yvel)<<8); - if (sector[s->sectnum].lotag== 2) + if (sector[s->sectnum].lotag == ST_2_UNDERWATER) s->zvel >>= 2; s->yvel++; } - if (s->z < actor[i].ceilingz) // && sector[sect].lotag != 2 ) + if (s->z < actor[i].ceilingz) // && sector[sect].lotag != ST_2_UNDERWATER ) { s->z = actor[i].ceilingz+(3<<8); s->zvel = 0; @@ -4486,7 +4486,7 @@ ACTOR_STATIC void G_MoveActors(void) actor[i].movflag = j; - if (sector[SECT].lotag == 1 && s->zvel == 0 && actor[i].floorz == sector[sect].floorz) + if (sector[SECT].lotag == ST_1_ABOVE_WATER && s->zvel == 0 && actor[i].floorz == sector[sect].floorz) { s->z += (32<<8); if (t[5] == 0) @@ -4513,7 +4513,7 @@ ACTOR_STATIC void G_MoveActors(void) if (s->xvel > 0) { s->xvel -= 5; - if (sector[sect].lotag == 2) + if (sector[sect].lotag == ST_2_UNDERWATER) s->xvel -= 10; if (s->xvel < 0) @@ -5004,7 +5004,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 t[0]++; if (t[0] == 1) { - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) + if (sector[sect].lotag != ST_1_ABOVE_WATER && sector[sect].lotag != ST_2_UNDERWATER) KILLIT(i); /* else @@ -5074,7 +5074,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 T1 += (krand()&63); if ((T1&2047) > 512 && (T1&2047) < 1596) { - if (sector[sect].lotag == 2) + if (sector[sect].lotag == ST_2_UNDERWATER) { if (s->zvel < 64) s->zvel += (g_spriteGravity>>5)+(krand()&7); @@ -5148,7 +5148,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 if (s->z < l-(2<<8)) { if (t[1] < 2) t[1]++; - else if (sector[sect].lotag != 2) + else if (sector[sect].lotag != ST_2_UNDERWATER) { t[1] = 0; if (s->picnum == DUKELEG || s->picnum == DUKETORSO || s->picnum == DUKEGUN) @@ -5166,7 +5166,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 if (s->zvel < 6144) { - if (sector[sect].lotag == 2) + if (sector[sect].lotag == ST_2_UNDERWATER) { if (s->zvel < 1024) s->zvel += 48; @@ -5326,7 +5326,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 if (sect < 0 || (sector[sect].floorz + 256) < s->z) KILLIT(i); - if (sector[sect].lotag == 2) + if (sector[sect].lotag == ST_2_UNDERWATER) { t[1]++; if (t[1] > 8) @@ -5371,7 +5371,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 if (s->z == actor[i].floorz-(ZOFFSET) && t[0] < 3) { s->zvel = -((3-t[0])<<8)-(krand()&511); - if (sector[sect].lotag == 2) + if (sector[sect].lotag == ST_2_UNDERWATER) s->zvel >>= 1; s->xrepeat >>= 1; s->yrepeat >>= 1; @@ -5887,7 +5887,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 break; } - if (sector[ps->cursectnum].lotag != 2) + if (sector[ps->cursectnum].lotag != ST_2_UNDERWATER) { if (g_playerSpawnPoints[p].os == s->sectnum) { @@ -5929,7 +5929,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 j = headspritesect[s->sectnum]; while (j >= 0) { - if (sprite[j].statnum != STAT_PLAYER && sector[sprite[j].sectnum].lotag != 2 && + if (sprite[j].statnum != STAT_PLAYER && sector[sprite[j].sectnum].lotag != ST_2_UNDERWATER && (sprite[j].picnum != SECTOREFFECTOR || (sprite[j].lotag == SE_49_POINT_LIGHT||sprite[j].lotag == SE_50_SPOT_LIGHT)) && sprite[j].picnum != LOCATORS) { @@ -5984,7 +5984,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 for (j=headspritesect[s->sectnum]; j >= 0; j=nextspritesect[j]) { // keep this conditional in sync with above! - if (sprite[j].statnum != STAT_PLAYER && sector[sprite[j].sectnum].lotag != 2 && + if (sprite[j].statnum != STAT_PLAYER && sector[sprite[j].sectnum].lotag != ST_2_UNDERWATER && (sprite[j].picnum != SECTOREFFECTOR || (sprite[j].lotag == SE_49_POINT_LIGHT||sprite[j].lotag == SE_50_SPOT_LIGHT)) && sprite[j].picnum != LOCATORS) { diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 5403b2e38..e9aaeed0c 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -4230,12 +4230,12 @@ int32_t A_Spawn(int32_t j, int32_t pn) sp->cstat |= 128; if (j >= 0) { - if (sector[sprite[j].sectnum].lotag == 2) + if (sector[sprite[j].sectnum].lotag == ST_2_UNDERWATER) { sp->z = getceilzofslope(SECT,SX,SY)+(16<<8); sp->cstat |= 8; } - else if (sector[sprite[j].sectnum].lotag == 1) + else if (sector[sprite[j].sectnum].lotag == ST_1_ABOVE_WATER) sp->z = getflorzofslope(SECT,SX,SY); } @@ -4417,7 +4417,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) } - if (sector[SECT].lotag == 1) + if (sector[SECT].lotag == ST_1_ABOVE_WATER) { changespritestat(i, STAT_MISC); break; @@ -4638,7 +4638,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) } sp->z = sector[sect].floorz; - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) + if (sector[sect].lotag != ST_1_ABOVE_WATER && sector[sect].lotag != ST_2_UNDERWATER) sp->xrepeat = sp->yrepeat = 32; A_AddToDeleteQueue(i); @@ -4852,7 +4852,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) sp->xrepeat = sprite[j].xrepeat; sp->yrepeat = sprite[j].yrepeat; sp->zvel = 128; - if (sector[sp->sectnum].lotag != 2) + if (sector[sp->sectnum].lotag != ST_2_UNDERWATER) sp->cstat |= 32768; } changespritestat(i, STAT_DUMMYPLAYER); @@ -4962,7 +4962,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) break; case TOUCHPLATE__STATIC: T3 = sector[sect].floorz; - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) + if (sector[sect].lotag != ST_1_ABOVE_WATER && sector[sect].lotag != ST_2_UNDERWATER) sector[sect].floorz = sp->z; if (sp->pal && (g_netServer || ud.multimode > 1)) { @@ -5374,8 +5374,8 @@ int32_t A_Spawn(int32_t j, int32_t pn) case 46: ror_protectedsectors[sp->sectnum] = 1; /* XXX: fall-through intended? */ - case 49: - case 50: + case SE_49_POINT_LIGHT: + case SE_50_SPOT_LIGHT: { int32_t j, nextj; @@ -5872,7 +5872,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) sp->shade = 0; } - else if (sp->lotag == 2) + else if (sp->lotag == SE_2_EARTHQUAKE) { T6 = sector[sp->sectnum].floorheinum; sector[sp->sectnum].floorheinum = 0; @@ -6571,7 +6571,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo #endif k = getofs_viewtype5(s, t, oura); - if (sector[s->sectnum].lotag == 2) k += 1795-1405; + if (sector[s->sectnum].lotag == ST_2_UNDERWATER) k += 1795-1405; else if ((actor[i].floorz-s->z) > (64<<8)) k += 60; t->picnum += k; @@ -6580,7 +6580,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo goto PALONLY; } - if (g_player[p].ps->on_crane == -1 && (sector[s->sectnum].lotag&0x7ff) != 1) + if (g_player[p].ps->on_crane == -1 && (sector[s->sectnum].lotag&0x7ff) != 1) // ST_1_ABOVE_WATER ? { l = s->z-actor[g_player[p].ps->i].floorz+(3<<8); if (l > 1024 && s->yrepeat > 32 && s->extra > 0) @@ -6624,7 +6624,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo #endif k = getofs_viewtype5(s, t, oura); - if (sector[t->sectnum].lotag == 2) k += 1795-1405; + if (sector[t->sectnum].lotag == ST_2_UNDERWATER) k += 1795-1405; else if ((actor[i].floorz-s->z) > (64<<8)) k += 60; t->picnum += k; @@ -6852,7 +6852,7 @@ skip: switch (DYNAMICTILEMAP(s->picnum)) { case LASERLINE__STATIC: - if (sector[t->sectnum].lotag == 2) t->pal = 8; + if (sector[t->sectnum].lotag == ST_2_UNDERWATER) t->pal = 8; t->z = sprite[s->owner].z-(3<<8); if (g_tripbombLaserMode == 2 && g_player[screenpeek].ps->heat_on == 0) t->yrepeat = 0; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 3597361ec..12026f454 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -366,7 +366,7 @@ void A_Fall(int32_t iActor) c = 0; else { - if (G_CheckForSpaceCeiling(s->sectnum) || sector[s->sectnum].lotag == 2) + if (G_CheckForSpaceCeiling(s->sectnum) || sector[s->sectnum].lotag == ST_2_UNDERWATER) c = g_spriteGravity/6; } @@ -397,7 +397,7 @@ void A_Fall(int32_t iActor) #endif ) { - if (sector[s->sectnum].lotag == 2 && s->zvel > 3122) + if (sector[s->sectnum].lotag == ST_2_UNDERWATER && s->zvel > 3122) s->zvel = 3144; s->z += s->zvel = min(6144, s->zvel+c); } @@ -1280,7 +1280,7 @@ skip_check: { int32_t j = g_spriteGravity; - if (G_CheckForSpaceCeiling(vm.g_sp->sectnum) || sector[vm.g_sp->sectnum].lotag == 2) + if (G_CheckForSpaceCeiling(vm.g_sp->sectnum) || sector[vm.g_sp->sectnum].lotag == ST_2_UNDERWATER) j = g_spriteGravity/6; else if (G_CheckForSpaceFloor(vm.g_sp->sectnum)) j = 0; @@ -1322,7 +1322,7 @@ skip_check: actor[vm.g_i].extra = 1; vm.g_sp->zvel = 0; } - else if (vm.g_sp->zvel > 2048 && sector[vm.g_sp->sectnum].lotag != 1) + else if (vm.g_sp->zvel > 2048 && sector[vm.g_sp->sectnum].lotag != ST_1_ABOVE_WATER) { j = vm.g_sp->sectnum; pushmove((vec3_t *)vm.g_sp,(int16_t *)&j,128L,(4L<<8),(4L<<8),CLIPMASK0); @@ -1340,7 +1340,7 @@ skip_check: vm.g_sp->z = (actor[vm.g_i].floorz - ZOFFSET); continue; } - else if (sector[vm.g_sp->sectnum].lotag == 1) + else if (sector[vm.g_sp->sectnum].lotag == ST_1_ABOVE_WATER) { switch (DYNAMICTILEMAP(vm.g_sp->picnum)) { @@ -3119,11 +3119,11 @@ nullquote: continue; case CON_IFONWATER: - VM_CONDITIONAL(sector[vm.g_sp->sectnum].lotag == 1 && klabs(vm.g_sp->z-sector[vm.g_sp->sectnum].floorz) < (32<<8)); + VM_CONDITIONAL(sector[vm.g_sp->sectnum].lotag == ST_1_ABOVE_WATER && klabs(vm.g_sp->z-sector[vm.g_sp->sectnum].floorz) < (32<<8)); continue; case CON_IFINWATER: - VM_CONDITIONAL(sector[vm.g_sp->sectnum].lotag == 2); + VM_CONDITIONAL(sector[vm.g_sp->sectnum].lotag == ST_2_UNDERWATER); continue; case CON_IFCOUNT: @@ -5219,7 +5219,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist) return; } - if (vm.g_sp->statnum != 1) + if (vm.g_sp->statnum != STAT_ACTOR) return; if (A_CheckEnemySprite(vm.g_sp)) diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 128b074d4..8388bda9b 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -65,7 +65,7 @@ void P_UpdateScreenPal(DukePlayer_t *p) } else { - if (sector[p->cursectnum].lotag == 2) p->palette = WATERPAL; + if (sector[p->cursectnum].lotag == ST_2_UNDERWATER) p->palette = WATERPAL; else p->palette = BASEPAL; intowater = 1; } @@ -141,7 +141,7 @@ static void A_DoWaterTracers(int32_t x1,int32_t y1,int32_t z1,int32_t x2,int32_t if (sect < 0) break; - if (sector[sect].lotag == 2) + if (sector[sect].lotag == ST_2_UNDERWATER) A_InsertSprite(sect,x1,y1,z1,WATERBUBBLE,-32,4+(krand()&3),4+(krand()&3),krand()&2047,0,0,g_player[0].ps->i,5); else A_InsertSprite(sect,x1,y1,z1,SMALLSMOKE,-32,14,14,0,0,0,g_player[0].ps->i,5); @@ -639,7 +639,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith) } } } - else if (p >= 0 && zvel > 0 && sector[hit.sect].lotag == 1) + else if (p >= 0 && zvel > 0 && sector[hit.sect].lotag == ST_1_ABOVE_WATER) { j = A_Spawn(g_player[p].ps->i,WATERSPLASH2); sprite[j].x = hit.pos.x; @@ -766,7 +766,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith) if (ProjectileData[atwith].workslike & PROJECTILE_WATERBUBBLES) { - if ((krand()&15) == 0 && sector[hit.sect].lotag == 2) + if ((krand()&15) == 0 && sector[hit.sect].lotag == ST_2_UNDERWATER) A_DoWaterTracers(hit.pos.x,hit.pos.y,hit.pos.z,srcvect.x,srcvect.y,srcvect.z,8-(ud.multimode>>1)); } @@ -1170,7 +1170,7 @@ DOSKIPBULLETHOLE: } } } - else if (p >= 0 && zvel > 0 && sector[hit.sect].lotag == 1) + else if (p >= 0 && zvel > 0 && sector[hit.sect].lotag == ST_1_ABOVE_WATER) { j = A_Spawn(g_player[p].ps->i,WATERSPLASH2); sprite[j].x = hit.pos.x; @@ -1272,7 +1272,7 @@ DOSKIPBULLETHOLE: if (hit.sect < 0) return -1; - if ((krand()&15) == 0 && sector[hit.sect].lotag == 2) + if ((krand()&15) == 0 && sector[hit.sect].lotag == ST_2_UNDERWATER) A_DoWaterTracers(hit.pos.x,hit.pos.y,hit.pos.z, srcvect.x,srcvect.y,srcvect.z,8-(ud.multimode>>1)); @@ -1656,6 +1656,7 @@ SKIPBULLETHOLE: if (hit.wall >= 0 && hit.sect >= 0) if (((hit.pos.x-srcvect.x)*(hit.pos.x-srcvect.x)+(hit.pos.y-srcvect.y)*(hit.pos.y-srcvect.y)) < (290*290)) { + // ST_2_UNDERWATER if (wall[hit.wall].nextsector >= 0) { if (sector[wall[hit.wall].nextsector].lotag <= 2 && sector[hit.sect].lotag <= 2) @@ -1803,7 +1804,7 @@ SKIPBULLETHOLE: if (j < 0) zvel = (100-ps->horiz-ps->horizoff)*98; } - else if (s->statnum != 3) + else if (s->statnum != STAT_EFFECTOR) { j = A_FindPlayer(s,&x); l = ldist(&sprite[g_player[j].ps->i],s); @@ -3260,7 +3261,7 @@ static int32_t P_DoCounters(DukePlayer_t *p) } } - if (p->cursectnum >= 0 && p->scuba_on == 0 && sector[p->cursectnum].lotag == 2) + if (p->cursectnum >= 0 && p->scuba_on == 0 && sector[p->cursectnum].lotag == ST_2_UNDERWATER) { if (p->inv_amount[GET_SCUBA] > 0) { @@ -3930,6 +3931,7 @@ void P_ProcessWeapon(int32_t snum) if (hit.sect < 0 || hit.sprite >= 0) break; + // ST_2_UNDERWATER if (hit.wall >= 0 && sector[hit.sect].lotag > 2) break; @@ -3948,6 +3950,7 @@ void P_ProcessWeapon(int32_t snum) j = nextspritesect[j]; } + // ST_2_UNDERWATER if (j == -1 && hit.wall >= 0 && (wall[hit.wall].cstat&16) == 0) if ((wall[hit.wall].nextsector >= 0 && sector[wall[hit.wall].nextsector].lotag <= 2) || @@ -4411,7 +4414,7 @@ void P_ProcessInput(int32_t snum) p->ohorizoff = p->horizoff; // calculates automatic view angle for playing without a mouse - if (p->aim_mode == 0 && p->on_ground && psectlotag != 2 && (sector[p->cursectnum].floorstat&2)) + if (p->aim_mode == 0 && p->on_ground && psectlotag != ST_2_UNDERWATER && (sector[p->cursectnum].floorstat&2)) { x = p->pos.x+(sintable[(p->ang+512)&2047]>>5); y = p->pos.y+(sintable[p->ang&2047]>>5); @@ -4525,7 +4528,7 @@ void P_ProcessInput(int32_t snum) if ((numplayers < 2 || g_netServer) && p->dead_flag == 0) P_FragPlayer(snum); - if (psectlotag == 2) + if (psectlotag == ST_2_UNDERWATER) { if (p->on_warping_sector == 0) { @@ -4670,7 +4673,7 @@ void P_ProcessInput(int32_t snum) i = 40; - if (psectlotag == 2) + if (psectlotag == ST_2_UNDERWATER) { // under water p->jumping_counter = 0; @@ -4787,10 +4790,10 @@ void P_ProcessInput(int32_t snum) } } - if (shrunk == 0 && (psectlotag == 0 || psectlotag == 2)) k = 32; + if (shrunk == 0 && (psectlotag == 0 || psectlotag == ST_2_UNDERWATER)) k = 32; else k = 16; - if (psectlotag != 2 && p->scuba_on == 1) + if (psectlotag != ST_2_UNDERWATER && p->scuba_on == 1) p->scuba_on = 0; if (p->pos.z > (fz-(k<<8))) @@ -4798,14 +4801,14 @@ void P_ProcessInput(int32_t snum) if (p->pos.z < (actor[p->i].ceilingz+(18<<8))) p->pos.z = actor[p->i].ceilingz+(18<<8); } - else if (psectlotag != 2) + else if (psectlotag != ST_2_UNDERWATER) { p->airleft = 15 * GAMETICSPERSEC; // 13 seconds if (p->scuba_on == 1) p->scuba_on = 0; - if (psectlotag == 1 && p->spritebridge == 0) + if (psectlotag == ST_1_ABOVE_WATER && p->spritebridge == 0) { if (shrunk == 0) { @@ -4895,7 +4898,7 @@ void P_ProcessInput(int32_t snum) } if ((p->pos.z+p->vel.z) >= (fz-(i<<8)) && p->cursectnum >= 0) // hit the ground - if (sector[p->cursectnum].lotag != 1) + if (sector[p->cursectnum].lotag != ST_1_ABOVE_WATER) { if (p->falling_counter > 62) P_QuickKill(p); @@ -4932,7 +4935,7 @@ void P_ProcessInput(int32_t snum) p->scream_voice = -1; } - if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->vel.z > (6144>>1)) + if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->vel.z > (6144>>1)) p->hard_landing = p->vel.z>>10; p->on_ground = 1; @@ -4996,7 +4999,7 @@ void P_ProcessInput(int32_t snum) if (p->jumping_counter < (1024+256)) { - if (psectlotag == 1 && p->jumping_counter > 768) + if (psectlotag == ST_1_ABOVE_WATER && p->jumping_counter > 768) { p->jumping_counter = 0; p->vel.z = -512; @@ -5017,7 +5020,7 @@ void P_ProcessInput(int32_t snum) p->pos.z += p->vel.z; - if ((psectlotag != 2 || cz != sector[p->cursectnum].ceilingz) && p->pos.z < (cz+(4<<8))) + if ((psectlotag != ST_2_UNDERWATER || cz != sector[p->cursectnum].ceilingz) && p->pos.z < (cz+(4<<8))) { p->jumping_counter = 0; if (p->vel.z < 0) @@ -5039,7 +5042,7 @@ void P_ProcessInput(int32_t snum) { int32_t tempang = g_player[snum].sync->avel<<1; - if (psectlotag == 2) p->angvel =(tempang-(tempang>>3))*ksgn(doubvel); + if (psectlotag == ST_2_UNDERWATER) p->angvel =(tempang-(tempang>>3))*ksgn(doubvel); else p->angvel = tempang*ksgn(doubvel); p->ang += p->angvel; @@ -5127,7 +5130,7 @@ void P_ProcessInput(int32_t snum) } break; - case 1: + case ST_1_ABOVE_WATER: if (!p->spritebridge) { if ((krand()&1) == 0) @@ -5149,7 +5152,7 @@ void P_ProcessInput(int32_t snum) j = 0; - if (psectlotag == 2) + if (psectlotag == ST_2_UNDERWATER) j = 0x1400; else if (p->on_ground && (TEST_SYNC_KEY(sb_snum, SK_CROUCH) || (*kb > 10 && aplWeaponWorksLike[p->curr_weapon][snum] == KNEE_WEAPON))) j = 0x2000; @@ -5168,10 +5171,10 @@ void P_ProcessInput(int32_t snum) } HORIZONLY: - if (psectlotag == 1 || p->spritebridge == 1) i = (4L<<8); + if (psectlotag == ST_1_ABOVE_WATER || p->spritebridge == 1) i = (4L<<8); else i = (20L<<8); - if (p->cursectnum >= 0 && sector[p->cursectnum].lotag == 2) k = 0; + if (p->cursectnum >= 0 && sector[p->cursectnum].lotag == ST_2_UNDERWATER) k = 0; else k = 1; if (ud.noclip) @@ -5193,7 +5196,7 @@ HORIZONLY: // this updatesectorz conflicts with Duke3d's way of teleporting through water, // so make it a bit conditional... OTOH, this way we have an ugly z jump when // changing from above water to underwater - if (sect >= 0 && !(sector[sect].lotag==1 && p->on_ground && fb>=0)) + if (sect >= 0 && !(sector[sect].lotag==ST_1_ABOVE_WATER && p->on_ground && fb>=0)) { if ((fb>=0 && !(sector[sect].floorstat&512)) || (cb>=0 && !(sector[sect].ceilingstat&512))) { @@ -5208,14 +5211,14 @@ HORIZONLY: // This makes the player view lower when shrunk. NOTE that it can get the // view below the sector floor (and does, when on the ground). - if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) + if (p->jetpack_on == 0 && psectlotag != ST_2_UNDERWATER && psectlotag != ST_1_ABOVE_WATER && shrunk) p->pos.z += 32<<8; if (p->jetpack_on == 0) { if (s->xvel > 16) { - if (psectlotag != 1 && psectlotag != 2 && p->on_ground) + if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground) { p->pycount += 52; p->pycount &= 2047; @@ -5223,7 +5226,7 @@ HORIZONLY: klabs(s->xvel*sintable[p->pycount])/1596; } } - else if (psectlotag != 2 && psectlotag != 1) + else if (psectlotag != ST_2_UNDERWATER && psectlotag != ST_1_ABOVE_WATER) p->pyoff = 0; } @@ -5233,6 +5236,7 @@ HORIZONLY: setsprite(p->i,(vec3_t *)&p->pos.x); p->pos.z -= PHEIGHT; + // ST_2_UNDERWATER if (p->cursectnum >= 0 && psectlotag < 3) { // p->cursectnum = s->sectnum; @@ -5247,7 +5251,8 @@ HORIZONLY: } } - if (p->cursectnum >= 0 && truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1) + if (p->cursectnum >= 0 && truefdist < PHEIGHT && p->on_ground && + psectlotag != ST_1_ABOVE_WATER && shrunk == 0 && sector[p->cursectnum].lotag == ST_1_ABOVE_WATER) if (!A_CheckSoundPlaying(p->i,DUKE_ONWATER)) A_PlaySound(DUKE_ONWATER,p->i); diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index fbde94ba5..1472f8141 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -329,7 +329,7 @@ void G_DoSectorAnimations(void) } for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j]) - if (sprite[j].statnum != 3) + if (sprite[j].statnum != STAT_EFFECTOR) { actor[j].bposz = sprite[j].z; sprite[j].z += v; @@ -1084,6 +1084,7 @@ void G_OperateActivators(int32_t low,int32_t snum) break; } + // ST_2_UNDERWATER if (sector[sprite[i].sectnum].lotag < 3) { j = headspritesect[sprite[i].sectnum]; @@ -1892,7 +1893,7 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith i= headspritestat[STAT_EFFECTOR]; while (i >= 0) { - if (SHT == wall[dawallnum].lotag && SLT == 3) + if (SHT == wall[dawallnum].lotag && SLT == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT) { T3 = j; T4 = darkestwall; @@ -1963,7 +1964,7 @@ int32_t Sect_DamageCeiling(int32_t sn) j = krand()&1; while (i >= 0) { - if (SHT == (sector[sn].hitag) && SLT == 3) + if (SHT == (sector[sn].hitag) && SLT == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT) { T3 = j; T5 = 1; @@ -2354,7 +2355,7 @@ void A_DamageObject(int32_t i,int32_t sn) if ((sprite[i].cstat&16) && SHT == 0 && SLT == 0 && sprite[i].statnum == STAT_DEFAULT) break; - if ((sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i) && sprite[i].statnum != 4) + if ((sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i) && sprite[i].statnum != STAT_PROJECTILE) { if (A_CheckEnemySprite(&sprite[i]) == 1) { diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index cc0481757..5affe9a00 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -338,6 +338,7 @@ void S_Cleanup(void) g_sounds[num].num--; // MUSICANDSFX uses t_data[0] to control restarting the sound + // ST_2_UNDERWATER if (i != -1 && sprite[i].picnum == MUSICANDSFX && sector[sprite[i].sectnum].lotag < 3 && sprite[i].lotag < 999) actor[i].t_data[0] = 0; @@ -605,7 +606,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) if (explosionp) { - if (peekps->cursectnum > -1 && sector[peekps->cursectnum].lotag == 2) + if (peekps->cursectnum > -1 && sector[peekps->cursectnum].lotag == ST_2_UNDERWATER) pitch -= 1024; } else @@ -613,7 +614,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) if (sndist > 32767 && PN != MUSICANDSFX && (g_sounds[num].m & 3) == 0) return -1; - if (peekps->cursectnum > -1 && sector[peekps->cursectnum].lotag == 2 && (g_sounds[num].m&4) == 0) + if (peekps->cursectnum > -1 && sector[peekps->cursectnum].lotag == ST_2_UNDERWATER && (g_sounds[num].m&4) == 0) pitch = -768; }