diff options
author | James Haley | 2011-02-23 09:25:47 +0000 |
---|---|---|
committer | James Haley | 2011-02-23 09:25:47 +0000 |
commit | 7604a0956a73158e0f19a9437307556bc9b4ba56 (patch) | |
tree | 151155d00470e8492c5fc558a7899bb4c0cf4b04 | |
parent | 71f19d8d1ff5b914ac3871d6f740aaff00db82aa (diff) | |
download | chocolate-doom-7604a0956a73158e0f19a9437307556bc9b4ba56.tar.gz chocolate-doom-7604a0956a73158e0f19a9437307556bc9b4ba56.tar.bz2 chocolate-doom-7604a0956a73158e0f19a9437307556bc9b4ba56.zip |
Removed all dead code containing P_Random calls to avoid false hits in
list, removed all remaining order-of-evaluation portability problems,
and heavily altered behavior of T_FireFlicker thinkers to match the
binary (had no clue they changed this previously!).
Subversion-branch: /branches/strife-branch
Subversion-revision: 2274
-rw-r--r-- | src/strife/p_inter.c | 7 | ||||
-rw-r--r-- | src/strife/p_lights.c | 272 | ||||
-rw-r--r-- | src/strife/p_map.c | 15 | ||||
-rw-r--r-- | src/strife/p_mobj.c | 67 | ||||
-rw-r--r-- | src/strife/p_switch.c | 2 |
5 files changed, 178 insertions, 185 deletions
diff --git a/src/strife/p_inter.c b/src/strife/p_inter.c index 10559d8f..7eed93bc 100644 --- a/src/strife/p_inter.c +++ b/src/strife/p_inter.c @@ -878,12 +878,7 @@ void P_KillMobj(mobj_t* source, mobj_t* target) } } - // villsa [STRIFE] unused - /* - target->tics -= P_Random()&3; - if (target->tics < 1) - target->tics = 1; - */ + // villsa [STRIFE] no death tics randomization // Drop stuff. // villsa [STRIFE] get item from dialog target diff --git a/src/strife/p_lights.c b/src/strife/p_lights.c index 5ea03903..1b5e1d8c 100644 --- a/src/strife/p_lights.c +++ b/src/strife/p_lights.c @@ -44,21 +44,25 @@ // // T_FireFlicker // +// [STRIFE] +// haleyjd 2011023: Changes to amount and duration of flicker +// void T_FireFlicker (fireflicker_t* flick) { int amount; - + if (--flick->count) - return; - - amount = (P_Random()&3)*16; - + return; + + amount = (P_Random() & 3) * 8; // [STRIFE] 16 -> 8 + if (flick->sector->lightlevel - amount < flick->minlight) - flick->sector->lightlevel = flick->minlight; + flick->sector->lightlevel = flick->minlight; else - flick->sector->lightlevel = flick->maxlight - amount; + flick->sector->lightlevel = flick->maxlight - amount; - flick->count = 4; + // [STRIFE] flicker count made random! + flick->count = (P_Random() & 3) + 1; } @@ -66,14 +70,17 @@ void T_FireFlicker (fireflicker_t* flick) // // P_SpawnFireFlicker // -void P_SpawnFireFlicker (sector_t* sector) +// [STRIFE] +// haleyjd 2011023: Changes to minimum light level and initial duration +// +void P_SpawnFireFlicker (sector_t* sector) { - fireflicker_t* flick; - + fireflicker_t* flick; + // Note that we are resetting sector attributes. // Nothing special about it during gameplay. sector->special = 0; - + flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC, 0); P_AddThinker (&flick->thinker); @@ -81,8 +88,8 @@ void P_SpawnFireFlicker (sector_t* sector) flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker; flick->sector = sector; flick->maxlight = sector->lightlevel; - flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16; - flick->count = 4; + flick->minlight = sector->lightlevel - 32; // [STRIFE] changed from min surrounding+16 + flick->count = 2; // [STRIFE]: Initial count 4 -> 2 } @@ -96,22 +103,23 @@ void P_SpawnFireFlicker (sector_t* sector) // T_LightFlash // Do flashing lights. // +// [STRIFE] Verified unmodified +// void T_LightFlash (lightflash_t* flash) { if (--flash->count) - return; - + return; + if (flash->sector->lightlevel == flash->maxlight) { - flash-> sector->lightlevel = flash->minlight; - flash->count = (P_Random()&flash->mintime)+1; + flash->sector->lightlevel = flash->minlight; + flash->count = (P_Random()&flash->mintime)+1; } else { - flash-> sector->lightlevel = flash->maxlight; - flash->count = (P_Random()&flash->maxtime)+1; + flash->sector->lightlevel = flash->maxlight; + flash->count = (P_Random()&flash->maxtime)+1; } - } @@ -122,13 +130,15 @@ void T_LightFlash (lightflash_t* flash) // After the map has been loaded, scan each sector // for specials that spawn thinkers // +// [STRIFE] Verified unmodified +// void P_SpawnLightFlash (sector_t* sector) { lightflash_t* flash; // nothing special about it during gameplay - sector->special = 0; - + sector->special = 0; + flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0); P_AddThinker (&flash->thinker); @@ -153,22 +163,23 @@ void P_SpawnLightFlash (sector_t* sector) // // T_StrobeFlash // -void T_StrobeFlash (strobe_t* flash) +// [STRIFE] Verified unmodified +// +void T_StrobeFlash (strobe_t* flash) { if (--flash->count) - return; - + return; + if (flash->sector->lightlevel == flash->minlight) { - flash-> sector->lightlevel = flash->maxlight; - flash->count = flash->brighttime; + flash-> sector->lightlevel = flash->maxlight; + flash->count = flash->brighttime; } else { - flash-> sector->lightlevel = flash->minlight; - flash->count =flash->darktime; + flash-> sector->lightlevel = flash->minlight; + flash->count =flash->darktime; } - } @@ -178,14 +189,16 @@ void T_StrobeFlash (strobe_t* flash) // After the map has been loaded, scan each sector // for specials that spawn thinkers // +// [STRIFE] Verified unmodified +// void P_SpawnStrobeFlash -( sector_t* sector, - int fastOrSlow, - int inSync ) +( sector_t* sector, + int fastOrSlow, + int inSync ) { - strobe_t* flash; - + strobe_t* flash; + flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0); P_AddThinker (&flash->thinker); @@ -196,36 +209,38 @@ P_SpawnStrobeFlash flash->thinker.function.acp1 = (actionf_p1) T_StrobeFlash; flash->maxlight = sector->lightlevel; flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel); - + if (flash->minlight == flash->maxlight) - flash->minlight = 0; + flash->minlight = 0; // nothing special about it during gameplay - sector->special = 0; + sector->special = 0; if (!inSync) - flash->count = (P_Random()&7)+1; + flash->count = (P_Random()&7)+1; else - flash->count = 1; + flash->count = 1; } // // Start strobing lights (usually from a trigger) // -void EV_StartLightStrobing(line_t* line) +// [STRIFE] Verified unmodified +// +void EV_StartLightStrobing(line_t* line) { - int secnum; - sector_t* sec; - + int secnum; + sector_t* sec; + secnum = -1; while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { - sec = §ors[secnum]; - if (sec->specialdata) - continue; - - P_SpawnStrobeFlash (sec,SLOWDARK, 0); + sec = §ors[secnum]; + if (sec->specialdata) + continue; + + P_SpawnStrobeFlash (sec, SLOWDARK, 0); } } @@ -234,33 +249,35 @@ void EV_StartLightStrobing(line_t* line) // // TURN LINE'S TAG LIGHTS OFF // +// [STRIFE] Verified unmodified +// void EV_TurnTagLightsOff(line_t* line) { - int i; - int j; - int min; - sector_t* sector; - sector_t* tsec; - line_t* templine; - + int i; + int j; + int min; + sector_t* sector; + sector_t* tsec; + line_t* templine; + sector = sectors; - + for (j = 0;j < numsectors; j++, sector++) { - if (sector->tag == line->tag) - { - min = sector->lightlevel; - for (i = 0;i < sector->linecount; i++) - { - templine = sector->lines[i]; - tsec = getNextSector(templine,sector); - if (!tsec) - continue; - if (tsec->lightlevel < min) - min = tsec->lightlevel; - } - sector->lightlevel = min; - } + if (sector->tag == line->tag) + { + min = sector->lightlevel; + for (i = 0;i < sector->linecount; i++) + { + templine = sector->lines[i]; + tsec = getNextSector(templine,sector); + if (!tsec) + continue; + if (tsec->lightlevel < min) + min = tsec->lightlevel; + } + sector->lightlevel = min; + } } } @@ -268,42 +285,44 @@ void EV_TurnTagLightsOff(line_t* line) // // TURN LINE'S TAG LIGHTS ON // +// [STRIFE] Verified unmodified +// void EV_LightTurnOn -( line_t* line, - int bright ) +( line_t* line, + int bright ) { - int i; - int j; - sector_t* sector; - sector_t* temp; - line_t* templine; - + int i; + int j; + sector_t* sector; + sector_t* temp; + line_t* templine; + sector = sectors; - + for (i=0;i<numsectors;i++, sector++) { - if (sector->tag == line->tag) - { - // bright = 0 means to search - // for highest light level - // surrounding sector - if (!bright) - { - for (j = 0;j < sector->linecount; j++) - { - templine = sector->lines[j]; - temp = getNextSector(templine,sector); - - if (!temp) - continue; - - if (temp->lightlevel > bright) - bright = temp->lightlevel; - } - } - sector-> lightlevel = bright; - } + if (sector->tag == line->tag) + { + // bright = 0 means to search + // for highest light level + // surrounding sector + if (!bright) + { + for (j = 0;j < sector->linecount; j++) + { + templine = sector->lines[j]; + temp = getNextSector(templine,sector); + + if (!temp) + continue; + + if (temp->lightlevel > bright) + bright = temp->lightlevel; + } + } + sector-> lightlevel = bright; + } } } @@ -311,38 +330,41 @@ EV_LightTurnOn // // Spawn glowing light // - -void T_Glow(glow_t* g) +// [STRIFE] Verified unmodified +// +void T_Glow(glow_t* g) { switch(g->direction) { - case -1: - // DOWN - g->sector->lightlevel -= GLOWSPEED; - if (g->sector->lightlevel <= g->minlight) - { - g->sector->lightlevel += GLOWSPEED; - g->direction = 1; - } - break; - - case 1: - // UP - g->sector->lightlevel += GLOWSPEED; - if (g->sector->lightlevel >= g->maxlight) - { - g->sector->lightlevel -= GLOWSPEED; - g->direction = -1; - } - break; + case -1: + // DOWN + g->sector->lightlevel -= GLOWSPEED; + if (g->sector->lightlevel <= g->minlight) + { + g->sector->lightlevel += GLOWSPEED; + g->direction = 1; + } + break; + + case 1: + // UP + g->sector->lightlevel += GLOWSPEED; + if (g->sector->lightlevel >= g->maxlight) + { + g->sector->lightlevel -= GLOWSPEED; + g->direction = -1; + } + break; } } - +// +// [STRIFE] Verified unmodified +// void P_SpawnGlowingLight(sector_t* sector) { glow_t* g; - + g = Z_Malloc( sizeof(*g), PU_LEVSPEC, 0); P_AddThinker(&g->thinker); diff --git a/src/strife/p_map.c b/src/strife/p_map.c index c557f968..206d8664 100644 --- a/src/strife/p_map.c +++ b/src/strife/p_map.c @@ -341,20 +341,7 @@ boolean PIT_CheckThing (mobj_t* thing) return true; // underneath // villsa [STRIFE] unused - // check for skulls slamming into things - /*if (tmthing->flags & MF_SKULLFLY) - { - damage = ((P_Random()%8)+1)*tmthing->info->damage; - - P_DamageMobj (thing, tmthing, tmthing, damage); - - tmthing->flags &= ~MF_SKULLFLY; - tmthing->momx = tmthing->momy = tmthing->momz = 0; - - P_SetMobjState (tmthing, tmthing->info->spawnstate); - - return false; // stop moving - }*/ + // check for skulls slamming into things (removed) // missiles can hit other things if (tmthing->flags & MF_MISSILE) diff --git a/src/strife/p_mobj.c b/src/strife/p_mobj.c index f20295b8..85b20e37 100644 --- a/src/strife/p_mobj.c +++ b/src/strife/p_mobj.c @@ -99,13 +99,7 @@ void P_ExplodeMissile (mobj_t* mo) P_SetMobjState (mo, mobjinfo[mo->type].deathstate); - // villsa [STRIFE] unused - /* - mo->tics -= P_Random()&3; - - if (mo->tics < 1) - mo->tics = 1; - */ + // villsa [STRIFE] removed tics randomization mo->flags &= ~MF_MISSILE; @@ -1050,13 +1044,12 @@ P_SpawnPuff fixed_t z ) { mobj_t* th; - int t = P_Random(); - + int t; + + t = P_Random(); z += ((t - P_Random()) << 10); - // [STRIFE] Unused - //th->momz = FRACUNIT; - //th->tics -= P_Random()&3; + // [STRIFE] removed momz and tics randomization th = P_SpawnMobj(x, y, z, MT_STRIFEPUFF); // [STRIFE]: new type @@ -1092,25 +1085,20 @@ mobj_t* P_SpawnSparkPuff(fixed_t x, fixed_t y, fixed_t z) // void P_SpawnBlood -( fixed_t x, - fixed_t y, - fixed_t z, - int damage ) +( fixed_t x, + fixed_t y, + fixed_t z, + int damage ) { - mobj_t* th; + mobj_t* th; + int temp; - int temp = P_Random(); + temp = P_Random(); z += (temp - P_Random()) << 10; th = P_SpawnMobj(x, y, z, MT_BLOOD_DEATH); th->momz = FRACUNIT*2; - // villsa [STRIFE] unused - /* - th->tics -= P_Random()&3; - - if (th->tics < 1) - th->tics = 1; - */ + // villsa [STRIFE]: removed tics randomization // villsa [STRIFE] different checks for damage range if(damage >= 10 && damage <= 13) @@ -1133,12 +1121,7 @@ P_SpawnBlood // void P_CheckMissileSpawn (mobj_t* th) { - // villsa [STRIFE] unused - /* - th->tics -= P_Random()&3; - if (th->tics < 1) - th->tics = 1; - */ + // villsa [STRIFE] removed tics randomization // move a little forward so an angle can // be computed if it immediately explodes @@ -1180,13 +1163,13 @@ mobj_t *P_SubstNullMobj(mobj_t *mobj) // mobj_t* P_SpawnMissile -( mobj_t* source, - mobj_t* dest, - mobjtype_t type ) +( mobj_t* source, + mobj_t* dest, + mobjtype_t type ) { - mobj_t* th; - angle_t an; - int dist; + mobj_t* th; + angle_t an; + int dist; th = P_SpawnMobj (source->x, source->y, @@ -1200,10 +1183,16 @@ P_SpawnMissile // fuzzy player if (dest->flags & MF_SHADOW) - an += (P_Random()-P_Random())<<21; + { + int t = P_Random(); // haleyjd 20110223: remove order-of-evaluation dependencies + an += (t - P_Random()) << 21; + } // villsa [STRIFE] check for heavily transparent things else if(dest->flags & MF_MVIS) - an += (P_Random()-P_Random())<<22; + { + int t = P_Random(); + an += (t - P_Random()) << 22; + } th->angle = an; an >>= ANGLETOFINESHIFT; diff --git a/src/strife/p_switch.c b/src/strife/p_switch.c index 9234c00d..bb70f890 100644 --- a/src/strife/p_switch.c +++ b/src/strife/p_switch.c @@ -233,7 +233,7 @@ static void P_SpawnBrokenGlass(line_t* line) glass->angle = (an << ANGLETOFINESHIFT); glass->momx = FixedMul(finecosine[an], (P_Random() & 3) << FRACBITS); - glass->momy = FixedMul(finesine[an], (P_Random() & 3) << FRACBITS); + glass->momy = FixedMul(finesine[an], (P_Random() & 3) << FRACBITS); glass->momz = (P_Random() & 7) << FRACBITS; glass->tics += (P_Random() + 7) & 7; } |