Skip to content

Commit baace24

Browse files
authored
Merge pull request odamex#982 from odamex/bugfix/static-init-fix
Fix Static Init Damage
2 parents c7a80e0 + 54ee811 commit baace24

File tree

4 files changed

+57
-17
lines changed

4 files changed

+57
-17
lines changed

common/p_boomfspec.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,18 @@ void P_PlayerInCompatibleSector(player_t* player)
12711271
sector_t* sector = player->mo->subsector->sector;
12721272
if (sector->special == 0 && sector->damageamount > 0) // Odamex Static Init Damage
12731273
{
1274-
P_ApplySectorDamage(player, sector->damageamount, 0);
1274+
if (sector->damageamount < 20)
1275+
{
1276+
P_ApplySectorDamageNoRandom(player, sector->damageamount, MOD_UNKNOWN);
1277+
}
1278+
else if (sector->damageamount < 50)
1279+
{
1280+
P_ApplySectorDamage(player, sector->damageamount, 5, MOD_UNKNOWN);
1281+
}
1282+
else
1283+
{
1284+
P_ApplySectorDamageNoWait(player, sector->damageamount, MOD_UNKNOWN);
1285+
}
12751286
}
12761287
// jff add if to handle old vs generalized types
12771288
else if (sector->special < 32) // regular sector specials

common/p_spec.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -2159,6 +2159,18 @@ bool P_PushSpecialLine(AActor* thing, line_t* line, int side)
21592159
return true;
21602160
}
21612161

2162+
void P_ApplySectorDamageNoWait(player_t* player, int damage, int mod)
2163+
{
2164+
P_DamageMobj(player->mo, NULL, NULL, damage, mod);
2165+
}
2166+
2167+
void P_ApplySectorDamageNoRandom(player_t* player, int damage, int mod)
2168+
{
2169+
if (!player->powers[pw_ironfeet])
2170+
if (!(level.time & 0x1f))
2171+
P_DamageMobj(player->mo, NULL, NULL, damage, mod);
2172+
}
2173+
21622174
void P_ApplySectorDamage(player_t* player, int damage, int leak, int mod)
21632175
{
21642176
if (!player->powers[pw_ironfeet] || (leak && P_Random(player->mo)<leak))

common/p_spec.h

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ bool P_MovingCeilingCompleted(sector_t *sector);
113113
bool P_MovingFloorCompleted(sector_t *sector);
114114
bool P_HandleSpecialRepeat(line_t* line);
115115
void P_ApplySectorDamage(player_t* player, int damage, int leak, int mod = 0);
116+
void P_ApplySectorDamageNoRandom(player_t* player, int damage, int mod = 0);
117+
void P_ApplySectorDamageNoWait(player_t* player, int damage, int mod = 0);
116118
void P_ApplySectorDamageEndLevel(player_t* player);
117119
void P_CollectSecretCommon(sector_t* sector, player_t* player);
118120
int P_FindSectorFromTagOrLine(int tag, const line_t* line, int start);

common/p_zdoomhexspec.cpp

+31-16
Original file line numberDiff line numberDiff line change
@@ -247,25 +247,40 @@ void P_PlayerInZDoomSector(player_t* player)
247247
player->hazardcount += sector->damageamount;
248248
player->hazardinterval = sector->damageinterval;
249249
}
250-
else
250+
251+
if (sector->special == 0) // ZDoom Static Init Damage
251252
{
252-
if (level.time % sector->damageinterval == 0)
253+
if (sector->damageamount < 20)
253254
{
254-
P_DamageMobj(player->mo, NULL, NULL, sector->damageamount);
255-
256-
if (sector->flags & SECF_ENDLEVEL && player->health <= 10)
257-
{
258-
if (serverside && sv_allowexit)
259-
{
260-
G_ExitLevel(0, 1);
261-
}
262-
}
263-
264-
if (sector->flags & SECF_DMGTERRAINFX)
265-
{
266-
// MAP_FORMAT_TODO: damage special effects
267-
}
255+
P_ApplySectorDamageNoRandom(player, sector->damageamount,
256+
MOD_UNKNOWN);
268257
}
258+
else if (sector->damageamount < 50)
259+
{
260+
P_ApplySectorDamage(player, sector->damageamount, 5, MOD_UNKNOWN);
261+
}
262+
else
263+
{
264+
P_ApplySectorDamageNoWait(player, sector->damageamount,
265+
MOD_UNKNOWN);
266+
}
267+
}
268+
else if (level.time % sector->damageinterval == 0)
269+
{
270+
P_DamageMobj(player->mo, NULL, NULL, sector->damageamount);
271+
}
272+
273+
if (sector->flags & SECF_ENDLEVEL && player->health <= 10)
274+
{
275+
if (serverside && sv_allowexit)
276+
{
277+
G_ExitLevel(0, 1);
278+
}
279+
}
280+
281+
if (sector->flags & SECF_DMGTERRAINFX)
282+
{
283+
// MAP_FORMAT_TODO: damage special effects
269284
}
270285
}
271286
}

0 commit comments

Comments
 (0)