Level_SetWeather: Use str instead of int

This commit is contained in:
Sally Coolatta 2024-09-14 12:18:58 -04:00
parent 5eb3ab9195
commit a7aaf0eddb
4 changed files with 24 additions and 6 deletions

View file

@ -4697,7 +4697,7 @@ preciptype_t get_precip(const char *word)
return i; return i;
} }
deh_warning("Couldn't find weather type named 'PRECIP_%s'",word); deh_warning("Couldn't find weather type named 'PRECIP_%s'",word);
return PRECIP_RAIN; return PRECIP_NONE;
} }
/// \todo Make ANY of this completely over-the-top math craziness obey the order of operations. /// \todo Make ANY of this completely over-the-top math craziness obey the order of operations.

View file

@ -141,7 +141,7 @@ unsigned char mapmd5[16];
// //
boolean udmf; boolean udmf;
static INT32 udmf_version; INT32 udmf_version;
size_t numvertexes, numsegs, numsectors, numsubsectors, numnodes, numlines, numsides, nummapthings; size_t numvertexes, numsegs, numsectors, numsubsectors, numnodes, numlines, numsides, nummapthings;
size_t num_orig_vertexes; size_t num_orig_vertexes;
vertex_t *vertexes; vertex_t *vertexes;

View file

@ -3195,14 +3195,31 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
break; break;
case 424: // Change Weather case 424: // Change Weather
{
preciptype_t new_precip = PRECIP_NONE;
if (udmf_version < 2)
{
new_precip = args[0];
}
else
{
new_precip = stringargs[0] ? get_number(stringargs[0]) : PRECIP_NONE;
}
if (args[1]) if (args[1])
{ {
globalweather = (UINT8)(args[0]); globalweather = new_precip;
P_SwitchWeather(globalweather); P_SwitchWeather(globalweather);
} }
else if (mo && mo->player && P_IsPartyPlayer(mo->player)) else
P_SwitchWeather(args[0]); {
if (mo && mo->player && P_IsPartyPlayer(mo->player))
{
P_SwitchWeather(new_precip);
}
}
break; break;
}
case 425: // Calls P_SetMobjState on calling mobj case 425: // Calls P_SetMobjState on calling mobj
{ {

View file

@ -64,8 +64,9 @@ extern size_t numspritelumps, max_spritelumps;
// //
// Lookup tables for map data. // Lookup tables for map data.
// //
#define UDMF_CURRENT_VERSION (1) #define UDMF_CURRENT_VERSION (2)
extern boolean udmf; extern boolean udmf;
extern INT32 udmf_version;
extern size_t numsprites; extern size_t numsprites;
extern spritedef_t *sprites; extern spritedef_t *sprites;