diff --git a/src/doomstat.h b/src/doomstat.h index cdc09cf86..f4f7acfd0 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -68,7 +68,6 @@ typedef struct { mobjtype_t type; precipeffect_t effects; - UINT8 randomstates; } precipprops_t; extern precipprops_t precipprops[MAXPRECIP]; diff --git a/src/g_game.c b/src/g_game.c index e15968b3e..488f350a7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -89,13 +89,13 @@ UINT8 curWeather = PRECIP_NONE; precipprops_t precipprops[MAXPRECIP] = { - {MT_NULL, 0, 0}, // PRECIP_NONE - {MT_RAIN, 0, 0}, // PRECIP_RAIN - {MT_SNOWFLAKE, 0, 2}, // PRECIP_SNOW - {MT_BLIZZARDSNOW, 0, 2}, // PRECIP_BLIZZARD - {MT_RAIN, PRECIPFX_THUNDER|PRECIPFX_LIGHTNING, 0}, // PRECIP_STORM - {MT_NULL, PRECIPFX_THUNDER|PRECIPFX_LIGHTNING, 0}, // PRECIP_STORM_NORAIN - {MT_RAIN, PRECIPFX_THUNDER, 0} // PRECIP_STORM_NOSTRIKES + {MT_NULL, 0}, // PRECIP_NONE + {MT_RAIN, 0}, // PRECIP_RAIN + {MT_SNOWFLAKE, 0}, // PRECIP_SNOW + {MT_BLIZZARDSNOW, 0}, // PRECIP_BLIZZARD + {MT_RAIN, PRECIPFX_THUNDER|PRECIPFX_LIGHTNING}, // PRECIP_STORM + {MT_NULL, PRECIPFX_THUNDER|PRECIPFX_LIGHTNING}, // PRECIP_STORM_NORAIN + {MT_RAIN, PRECIPFX_THUNDER} // PRECIP_STORM_NOSTRIKES }; INT32 cursaveslot = -1; // Auto-save 1p savegame slot diff --git a/src/info.c b/src/info.c index 4542e6c3a..018d354f5 100644 --- a/src/info.c +++ b/src/info.c @@ -11486,7 +11486,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4*FRACUNIT, // height 0, // display offset 0, // mass - 0, // damage + 2, // damage sfx_None, // activesound MF_NOBLOCKMAP, // flags S_NULL // raisestate @@ -11513,7 +11513,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 4*FRACUNIT, // height 0, // display offset 0, // mass - 0, // damage + 2, // damage sfx_None, // activesound MF_NOBLOCKMAP, // flags S_NULL // raisestate diff --git a/src/p_mobj.c b/src/p_mobj.c index 87fb7a186..2f514f526 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11005,6 +11005,8 @@ consvar_t cv_suddendeath = {"suddendeath", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHE void P_SpawnPrecipitation(void) { INT32 i, j, k; + mobjtype_t type = precipprops[curWeather].type; + INT32 randomstates = mobjinfo[type].damage; fixed_t basex, basey, x, y, z, height; subsector_t *precipsector = NULL; precipmobj_t *rainmo = NULL; @@ -11049,15 +11051,15 @@ void P_SpawnPrecipitation(void) for (j = 0; j < numparticles; j++) { - rainmo = P_SpawnPrecipMobj(x, y, z, precipprops[curWeather].type); + rainmo = P_SpawnPrecipMobj(x, y, z, type); - if (precipprops[curWeather].randomstates > 0) + if (randomstates > 0 && randomstates < UINT8_MAX) { UINT8 mrand = M_RandomByte(); - UINT8 threshold = UINT8_MAX / (precipprops[curWeather].randomstates + 1); - statenum_t st = mobjinfo[precipprops[curWeather].type].spawnstate; + UINT8 threshold = UINT8_MAX / (randomstates + 1); + statenum_t st = mobjinfo[type].spawnstate; - for (k = 0; k < precipprops[curWeather].randomstates; k++) + for (k = 0; k < randomstates; k++) { if (mrand < (threshold * (k+1))) { diff --git a/src/p_spec.c b/src/p_spec.c index d92fb2f3b..1cca2cd5e 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2041,6 +2041,7 @@ void P_SwitchWeather(UINT8 newWeather) } else if (swap != MT_NULL) // Rather than respawn all that crap, reuse it! { + INT32 randomstates = mobjinfo[swap].damage; thinker_t *think; precipmobj_t *precipmobj; statenum_t st; @@ -2056,13 +2057,13 @@ void P_SwitchWeather(UINT8 newWeather) st = mobjinfo[swap].spawnstate; - if (precipprops[curWeather].randomstates > 0) + if (randomstates > 0 && randomstates < UINT8_MAX) { UINT8 mrand = M_RandomByte(); - UINT8 threshold = UINT8_MAX / (precipprops[curWeather].randomstates + 1); + UINT8 threshold = UINT8_MAX / (randomstates + 1); UINT8 i; - for (i = 0; i < precipprops[curWeather].randomstates; i++) + for (i = 0; i < randomstates; i++) { if (mrand < (threshold * (i+1))) {