Merge branch 'thing-script-args' into 'master'

Separate script args from mapthing args

See merge request KartKrew/Kart!1405
This commit is contained in:
Oni 2023-08-25 23:29:06 +00:00
commit bc0a187961
28 changed files with 985 additions and 749 deletions

View file

@ -1064,7 +1064,7 @@ bool CallFunc_SetLineSpecial(ACSVM::Thread *thread, const ACSVM::Word *argV, ACS
tag = argV[0]; tag = argV[0];
spec = argV[1]; spec = argV[1];
numArgs = std::min(std::max((signed)(argC - 2), 0), NUMLINEARGS); numArgs = std::min(std::max((signed)(argC - 2), 0), NUM_SCRIPT_ARGS);
TAG_ITER_LINES(tag, lineId) TAG_ITER_LINES(tag, lineId)
{ {

View file

@ -303,13 +303,13 @@ ACSVM::Word Environment::callSpecImpl
auto info = &static_cast<Thread *>(thread)->info; auto info = &static_cast<Thread *>(thread)->info;
ACSVM::MapScope *const map = thread->scopeMap; ACSVM::MapScope *const map = thread->scopeMap;
INT32 args[NUMLINEARGS] = {0}; INT32 args[NUM_SCRIPT_ARGS] = {0};
char *stringargs[NUMLINESTRINGARGS] = {0}; char *stringargs[NUM_SCRIPT_STRINGARGS] = {0};
auto _ = srb2::finally( auto _ = srb2::finally(
[stringargs]() [stringargs]()
{ {
for (int i = 0; i < NUMLINESTRINGARGS; i++) for (int i = 0; i < NUM_SCRIPT_STRINGARGS; i++)
{ {
Z_Free(stringargs[i]); Z_Free(stringargs[i]);
} }
@ -327,7 +327,7 @@ ACSVM::Word Environment::callSpecImpl
int i = 0; int i = 0;
for (i = 0; i < std::min((signed)(argC), NUMLINESTRINGARGS); i++) for (i = 0; i < std::min((signed)(argC), NUM_SCRIPT_STRINGARGS); i++)
{ {
ACSVM::String *strPtr = map->getString(argV[i]); ACSVM::String *strPtr = map->getString(argV[i]);
@ -335,7 +335,7 @@ ACSVM::Word Environment::callSpecImpl
M_Memcpy(stringargs[i], strPtr->str, strPtr->len + 1); M_Memcpy(stringargs[i], strPtr->str, strPtr->len + 1);
} }
for (i = 0; i < std::min((signed)(argC), NUMLINEARGS); i++) for (i = 0; i < std::min((signed)(argC), NUM_SCRIPT_ARGS); i++)
{ {
args[i] = argV[i]; args[i] = argV[i];
} }

View file

@ -36,6 +36,11 @@ extern "C" {
// used in the lumps of the WAD files. // used in the lumps of the WAD files.
// //
// Number of args for ACS scripts.
// Increasing this requires you to also update the ACS compiler.
#define NUM_SCRIPT_ARGS 10
#define NUM_SCRIPT_STRINGARGS 2
// Lump order in a map WAD: each map needs a couple of lumps // Lump order in a map WAD: each map needs a couple of lumps
// to provide a complete scene geometry description. // to provide a complete scene geometry description.
enum enum
@ -248,8 +253,10 @@ struct mapUserProperties_t
size_t capacity; size_t capacity;
}; };
#define NUMMAPTHINGARGS 10 // Number of args for thing behaviors.
#define NUMMAPTHINGSTRINGARGS 2 // These are safe to increase at any time.
#define NUM_MAPTHING_ARGS 10
#define NUM_MAPTHING_STRINGARGS 2
// Thing definition, position, orientation and type, // Thing definition, position, orientation and type,
// plus visibility flags and attributes. // plus visibility flags and attributes.
@ -263,9 +270,12 @@ struct mapthing_t
UINT8 extrainfo; UINT8 extrainfo;
mtag_t tid; mtag_t tid;
fixed_t scale; fixed_t scale;
fixed_t spritexscale, spriteyscale;
INT32 thing_args[NUM_MAPTHING_ARGS];
char *thing_stringargs[NUM_MAPTHING_STRINGARGS];
INT16 special; INT16 special;
INT32 args[NUMMAPTHINGARGS]; INT32 script_args[NUM_SCRIPT_ARGS];
char *stringargs[NUMMAPTHINGSTRINGARGS]; char *script_stringargs[NUM_SCRIPT_STRINGARGS];
UINT8 layer; // FOF layer to spawn on, see P_GetMobjSpawnHeight UINT8 layer; // FOF layer to spawn on, see P_GetMobjSpawnHeight
mapUserProperties_t user; // UDMF user-defined custom properties. mapUserProperties_t user; // UDMF user-defined custom properties.
mobj_t *mobj; mobj_t *mobj;

View file

@ -3768,7 +3768,7 @@ void G_AddGhost(savebuffer_t *buffer, char *defdemoname)
gh->mo->angle = FixedAngle(mthing->angle << FRACBITS); gh->mo->angle = FixedAngle(mthing->angle << FRACBITS);
f = gh->mo->floorz; f = gh->mo->floorz;
c = gh->mo->ceilingz - mobjinfo[MT_PLAYER].height; c = gh->mo->ceilingz - mobjinfo[MT_PLAYER].height;
if (!!(mthing->args[0]) ^ !!(mthing->options & MTF_OBJECTFLIP)) if (!!(mthing->thing_args[0]) ^ !!(mthing->options & MTF_OBJECTFLIP))
{ {
z = c - offset; z = c - offset;
if (z < f) if (z < f)

View file

@ -712,10 +712,10 @@ void K_RunBattleOvertime(void)
void K_SetupMovingCapsule(mapthing_t *mt, mobj_t *mobj) void K_SetupMovingCapsule(mapthing_t *mt, mobj_t *mobj)
{ {
UINT8 sequence = mt->args[0] - 1; UINT8 sequence = mt->thing_args[0] - 1;
fixed_t speed = (FRACUNIT >> 3) * mt->args[1]; fixed_t speed = (FRACUNIT >> 3) * mt->thing_args[1];
boolean backandforth = (mt->args[2] & TMBCF_BACKANDFORTH); boolean backandforth = (mt->thing_args[2] & TMBCF_BACKANDFORTH);
boolean reverse = (mt->args[2] & TMBCF_REVERSE); boolean reverse = (mt->thing_args[2] & TMBCF_REVERSE);
mobj_t *target = NULL; mobj_t *target = NULL;
// Find the inital target // Find the inital target

View file

@ -77,7 +77,7 @@ boolean K_IsDuelItem(mobjtype_t type)
boolean K_DuelItemAlwaysSpawns(mapthing_t *mt) boolean K_DuelItemAlwaysSpawns(mapthing_t *mt)
{ {
return !!(mt->args[0]); return !!(mt->thing_args[0]);
} }
static void K_SpawnDuelOnlyItems(void) static void K_SpawnDuelOnlyItems(void)
@ -122,14 +122,14 @@ static void K_SpawnItemCapsules(void)
continue; continue;
} }
isRingCapsule = (mt->args[0] < 1 || mt->args[0] == KITEM_SUPERRING || mt->args[0] >= NUMKARTITEMS); isRingCapsule = (mt->thing_args[0] < 1 || mt->thing_args[0] == KITEM_SUPERRING || mt->thing_args[0] >= NUMKARTITEMS);
if (isRingCapsule == true && ((gametyperules & GTR_SPHERES) || (modeattacking & ATTACKING_SPB))) if (isRingCapsule == true && ((gametyperules & GTR_SPHERES) || (modeattacking & ATTACKING_SPB)))
{ {
// don't spawn ring capsules in ringless gametypes // don't spawn ring capsules in ringless gametypes
continue; continue;
} }
modeFlags = mt->args[3]; modeFlags = mt->thing_args[3];
if (modeFlags == TMICM_DEFAULT) if (modeFlags == TMICM_DEFAULT)
{ {
if (isRingCapsule == true) if (isRingCapsule == true)

View file

@ -2399,7 +2399,7 @@ static boolean K_AnchorWaypointRadius(
anchor->x, anchor->y); anchor->x, anchor->y);
// Keep changes for -writetextmap // Keep changes for -writetextmap
waypointmobj->spawnpoint->args[1] = waypointmobj->radius >> FRACBITS; waypointmobj->spawnpoint->thing_args[1] = waypointmobj->radius >> FRACBITS;
return true; return true;
} }
else else

View file

@ -601,16 +601,16 @@ static int sectorargs_get(lua_State *L)
{ {
INT32 *args = *((INT32**)luaL_checkudata(L, 1, META_SECTORARGS)); INT32 *args = *((INT32**)luaL_checkudata(L, 1, META_SECTORARGS));
int i = luaL_checkinteger(L, 2); int i = luaL_checkinteger(L, 2);
if (i < 0 || i >= NUMSECTORARGS) if (i < 0 || i >= NUM_SCRIPT_ARGS)
return luaL_error(L, LUA_QL("sector_t.args") " index cannot be %d", i); return luaL_error(L, LUA_QL("sector_t.args") " index cannot be %d", i);
lua_pushinteger(L, args[i]); lua_pushinteger(L, args[i]);
return 1; return 1;
} }
// #args -> NUMSECTORARGS // #args -> NUM_SCRIPT_ARGS
static int sectorargs_len(lua_State* L) static int sectorargs_len(lua_State* L)
{ {
lua_pushinteger(L, NUMSECTORARGS); lua_pushinteger(L, NUM_SCRIPT_ARGS);
return 1; return 1;
} }
@ -619,16 +619,16 @@ static int sectorstringargs_get(lua_State *L)
{ {
char **stringargs = *((char***)luaL_checkudata(L, 1, META_SECTORSTRINGARGS)); char **stringargs = *((char***)luaL_checkudata(L, 1, META_SECTORSTRINGARGS));
int i = luaL_checkinteger(L, 2); int i = luaL_checkinteger(L, 2);
if (i < 0 || i >= NUMSECTORSTRINGARGS) if (i < 0 || i >= NUM_SCRIPT_STRINGARGS)
return luaL_error(L, LUA_QL("line_t.stringargs") " index cannot be %d", i); return luaL_error(L, LUA_QL("sector_t.stringargs") " index cannot be %d", i);
lua_pushstring(L, stringargs[i]); lua_pushstring(L, stringargs[i]);
return 1; return 1;
} }
// #stringargs -> NUMLINESTRINGARGS // #stringargs -> NUM_SCRIPT_STRINGARGS
static int sectorstringargs_len(lua_State *L) static int sectorstringargs_len(lua_State *L)
{ {
lua_pushinteger(L, NUMSECTORSTRINGARGS); lua_pushinteger(L, NUM_SCRIPT_STRINGARGS);
return 1; return 1;
} }
@ -944,16 +944,16 @@ static int lineargs_get(lua_State *L)
{ {
INT32 *args = *((INT32**)luaL_checkudata(L, 1, META_LINEARGS)); INT32 *args = *((INT32**)luaL_checkudata(L, 1, META_LINEARGS));
int i = luaL_checkinteger(L, 2); int i = luaL_checkinteger(L, 2);
if (i < 0 || i >= NUMLINEARGS) if (i < 0 || i >= NUM_SCRIPT_ARGS)
return luaL_error(L, LUA_QL("line_t.args") " index cannot be %d", i); return luaL_error(L, LUA_QL("line_t.args") " index cannot be %d", i);
lua_pushinteger(L, args[i]); lua_pushinteger(L, args[i]);
return 1; return 1;
} }
// #args -> NUMLINEARGS // #args -> NUM_SCRIPT_ARGS
static int lineargs_len(lua_State* L) static int lineargs_len(lua_State* L)
{ {
lua_pushinteger(L, NUMLINEARGS); lua_pushinteger(L, NUM_SCRIPT_ARGS);
return 1; return 1;
} }
@ -962,16 +962,16 @@ static int linestringargs_get(lua_State *L)
{ {
char **stringargs = *((char***)luaL_checkudata(L, 1, META_LINESTRINGARGS)); char **stringargs = *((char***)luaL_checkudata(L, 1, META_LINESTRINGARGS));
int i = luaL_checkinteger(L, 2); int i = luaL_checkinteger(L, 2);
if (i < 0 || i >= NUMLINESTRINGARGS) if (i < 0 || i >= NUM_SCRIPT_STRINGARGS)
return luaL_error(L, LUA_QL("line_t.stringargs") " index cannot be %d", i); return luaL_error(L, LUA_QL("line_t.stringargs") " index cannot be %d", i);
lua_pushstring(L, stringargs[i]); lua_pushstring(L, stringargs[i]);
return 1; return 1;
} }
// #stringargs -> NUMLINESTRINGARGS // #stringargs -> NUM_SCRIPT_STRINGARGS
static int linestringargs_len(lua_State *L) static int linestringargs_len(lua_State *L)
{ {
lua_pushinteger(L, NUMLINESTRINGARGS); lua_pushinteger(L, NUM_SCRIPT_STRINGARGS);
return 1; return 1;
} }

View file

@ -488,10 +488,10 @@ static int mobj_get(lua_State *L)
lua_pushinteger(L, mo->special); lua_pushinteger(L, mo->special);
break; break;
case mobj_args: case mobj_args:
LUA_PushUserdata(L, mo->args, META_THINGARGS); LUA_PushUserdata(L, mo->thing_args, META_THINGARGS);
break; break;
case mobj_stringargs: case mobj_stringargs:
LUA_PushUserdata(L, mo->stringargs, META_THINGSTRINGARGS); LUA_PushUserdata(L, mo->thing_stringargs, META_THINGSTRINGARGS);
break; break;
default: // extra custom variables in Lua memory default: // extra custom variables in Lua memory
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
@ -916,16 +916,16 @@ static int thingargs_get(lua_State *L)
{ {
INT32 *args = *((INT32**)luaL_checkudata(L, 1, META_THINGARGS)); INT32 *args = *((INT32**)luaL_checkudata(L, 1, META_THINGARGS));
int i = luaL_checkinteger(L, 2); int i = luaL_checkinteger(L, 2);
if (i < 0 || i >= NUMMAPTHINGARGS) if (i < 0 || i >= NUM_MAPTHING_ARGS)
return luaL_error(L, LUA_QL("mapthing_t.args") " index cannot be %d", i); return luaL_error(L, LUA_QL("mapthing_t.args") " index cannot be %d", i);
lua_pushinteger(L, args[i]); lua_pushinteger(L, args[i]);
return 1; return 1;
} }
// #args -> NUMMAPTHINGARGS // #args -> NUM_MAPTHING_ARGS
static int thingargs_len(lua_State* L) static int thingargs_len(lua_State* L)
{ {
lua_pushinteger(L, NUMMAPTHINGARGS); lua_pushinteger(L, NUM_MAPTHING_ARGS);
return 1; return 1;
} }
@ -934,16 +934,16 @@ static int thingstringargs_get(lua_State *L)
{ {
char **stringargs = *((char***)luaL_checkudata(L, 1, META_THINGSTRINGARGS)); char **stringargs = *((char***)luaL_checkudata(L, 1, META_THINGSTRINGARGS));
int i = luaL_checkinteger(L, 2); int i = luaL_checkinteger(L, 2);
if (i < 0 || i >= NUMMAPTHINGSTRINGARGS) if (i < 0 || i >= NUM_MAPTHING_STRINGARGS)
return luaL_error(L, LUA_QL("mapthing_t.stringargs") " index cannot be %d", i); return luaL_error(L, LUA_QL("mapthing_t.stringargs") " index cannot be %d", i);
lua_pushstring(L, stringargs[i]); lua_pushstring(L, stringargs[i]);
return 1; return 1;
} }
// #stringargs -> NUMMAPTHINGSTRINGARGS // #stringargs -> NUM_MAPTHING_STRINGARGS
static int thingstringargs_len(lua_State *L) static int thingstringargs_len(lua_State *L)
{ {
lua_pushinteger(L, NUMMAPTHINGSTRINGARGS); lua_pushinteger(L, NUM_MAPTHING_STRINGARGS);
return 1; return 1;
} }
@ -982,6 +982,10 @@ static int mapthing_get(lua_State *L)
number = mt->options; number = mt->options;
else if(fastcmp(field,"scale")) else if(fastcmp(field,"scale"))
number = mt->scale; number = mt->scale;
else if(fastcmp(field,"spritexscale"))
number = mt->spritexscale;
else if(fastcmp(field,"spriteyscale"))
number = mt->spriteyscale;
else if(fastcmp(field,"z")) else if(fastcmp(field,"z"))
number = mt->z; number = mt->z;
else if(fastcmp(field,"extrainfo")) else if(fastcmp(field,"extrainfo"))
@ -992,12 +996,12 @@ static int mapthing_get(lua_State *L)
number = mt->special; number = mt->special;
else if(fastcmp(field,"args")) else if(fastcmp(field,"args"))
{ {
LUA_PushUserdata(L, mt->args, META_THINGARGS); LUA_PushUserdata(L, mt->thing_args, META_THINGARGS);
return 1; return 1;
} }
else if(fastcmp(field,"stringargs")) else if(fastcmp(field,"stringargs"))
{ {
LUA_PushUserdata(L, mt->stringargs, META_THINGSTRINGARGS); LUA_PushUserdata(L, mt->thing_stringargs, META_THINGSTRINGARGS);
return 1; return 1;
} }
else if(fastcmp(field,"mobj")) { else if(fastcmp(field,"mobj")) {

View file

@ -900,8 +900,8 @@ void LUA_InvalidateMapthings(void)
for (i = 0; i < nummapthings; i++) for (i = 0; i < nummapthings; i++)
{ {
LUA_InvalidateUserdata(&mapthings[i]); LUA_InvalidateUserdata(&mapthings[i]);
LUA_InvalidateUserdata(mapthings[i].args); LUA_InvalidateUserdata(mapthings[i].thing_args);
LUA_InvalidateUserdata(mapthings[i].stringargs); LUA_InvalidateUserdata(mapthings[i].thing_stringargs);
} }
} }

View file

@ -792,8 +792,11 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
mt->options = (mt->z << ZSHIFT) | (UINT16)cv_opflags.value; mt->options = (mt->z << ZSHIFT) | (UINT16)cv_opflags.value;
mt->scale = player->mo->scale; mt->scale = player->mo->scale;
memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args)); memset(mt->thing_args, 0, NUM_MAPTHING_ARGS*sizeof(*mt->thing_args));
memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs)); memset(mt->thing_stringargs, 0x00, NUM_MAPTHING_STRINGARGS*sizeof(*mt->thing_stringargs));
mt->special = 0;
memset(mt->script_args, 0, NUM_SCRIPT_ARGS*sizeof(*mt->script_args));
memset(mt->script_stringargs, 0x00, NUM_SCRIPT_STRINGARGS*sizeof(*mt->script_stringargs));
mt->pitch = mt->roll = 0; mt->pitch = mt->roll = 0;
return mt; return mt;
} }

View file

@ -16,7 +16,7 @@ void Obj_ArkArrowSpawn(mobj_t *mobj)
void Obj_ArkArrowSetup(mobj_t *mobj, mapthing_t *mthing) void Obj_ArkArrowSetup(mobj_t *mobj, mapthing_t *mthing)
{ {
const fixed_t oldHeight = mobj->height; const fixed_t oldHeight = mobj->height;
statenum_t stateNum = mobj->info->spawnstate + mthing->args[0]; statenum_t stateNum = mobj->info->spawnstate + mthing->thing_args[0];
if (stateNum - mobj->info->spawnstate >= ARKARROW_OPTIONS) if (stateNum - mobj->info->spawnstate >= ARKARROW_OPTIONS)
{ {

View file

@ -38,10 +38,10 @@ Obj_AudienceInit
// Pick follower // Pick follower
if (mthing != NULL) if (mthing != NULL)
{ {
if (mthing->stringargs[0] != NULL) if (mthing->thing_stringargs[0] != NULL)
{ {
// From mapthing // From mapthing
char *stringcopy = Z_StrDup(mthing->stringargs[0]); char *stringcopy = Z_StrDup(mthing->thing_stringargs[0]);
char *tok = strtok(stringcopy, " ,"); char *tok = strtok(stringcopy, " ,");
char *c; // for erasing underscores char *c; // for erasing underscores
@ -141,15 +141,15 @@ Obj_AudienceInit
{ {
UINT16 colorpick = SKINCOLOR_NONE; UINT16 colorpick = SKINCOLOR_NONE;
if (mthing->stringargs[1] != NULL) if (mthing->thing_stringargs[1] != NULL)
{ {
if (!stricmp("Random", mthing->stringargs[1])) if (!stricmp("Random", mthing->thing_stringargs[1]))
{ {
colorpick = FOLLOWERCOLOR_MATCH; colorpick = FOLLOWERCOLOR_MATCH;
} }
else else
{ {
char *stringcopy = Z_StrDup(mthing->stringargs[1]); char *stringcopy = Z_StrDup(mthing->thing_stringargs[1]);
char *tok = strtok(stringcopy, " "); char *tok = strtok(stringcopy, " ");
numref = 0; numref = 0;

View file

@ -14,7 +14,7 @@
#define BATTLEUFO_BOB_AMP (4) // UFO bob strength #define BATTLEUFO_BOB_AMP (4) // UFO bob strength
#define BATTLEUFO_BOB_SPEED (TICRATE*2) // UFO bob speed #define BATTLEUFO_BOB_SPEED (TICRATE*2) // UFO bob speed
#define spawner_id(o) ((o)->args[0]) #define spawner_id(o) ((o)->thing_args[0])
#define ufo_spawner(o) ((o)->target) #define ufo_spawner(o) ((o)->target)

View file

@ -67,10 +67,10 @@ void Obj_RainbowDashRingSpawn(mobj_t *mobj)
void Obj_DashRingSetup(mobj_t *mobj, mapthing_t *mthing) void Obj_DashRingSetup(mobj_t *mobj, mapthing_t *mthing)
{ {
static const UINT8 numColors = sizeof(rainbow_colors) / sizeof(skincolornum_t); static const UINT8 numColors = sizeof(rainbow_colors) / sizeof(skincolornum_t);
const UINT8 additionalThrust = mthing->args[1]; const UINT8 additionalThrust = mthing->thing_args[1];
statenum_t ringState, overlayState; statenum_t ringState, overlayState;
mobj->extravalue1 = mthing->args[0]; mobj->extravalue1 = mthing->thing_args[0];
mobj->cusval = 4 + additionalThrust; mobj->cusval = 4 + additionalThrust;
switch (mobj->extravalue1) switch (mobj->extravalue1)

View file

@ -178,8 +178,8 @@ Obj_InitLoopEndpoint
void void
Obj_InitLoopCenter (mobj_t *center) Obj_InitLoopCenter (mobj_t *center)
{ {
center_max_revolution(center) = center->args[1] * FRACUNIT / 360; center_max_revolution(center) = center->thing_args[1] * FRACUNIT / 360;
center_set_flip(center, center->args[0]); center_set_flip(center, center->thing_args[0]);
} }
void void

View file

@ -3435,7 +3435,7 @@ static void P_DoBossVictory(mobj_t *mo)
} }
// victory! // victory!
P_LinedefExecute(mo->args[3], mo, NULL); P_LinedefExecute(mo->thing_args[3], mo, NULL);
if (stoppedclock && modeattacking) // if you're just time attacking, skip making the capsule appear since you don't need to step on it anyways. if (stoppedclock && modeattacking) // if you're just time attacking, skip making the capsule appear since you don't need to step on it anyways.
return; return;
@ -3459,7 +3459,7 @@ static void P_DoBossVictory(mobj_t *mo)
static void P_DoBossDefaultDeath(mobj_t *mo) static void P_DoBossDefaultDeath(mobj_t *mo)
{ {
INT32 bossid = mo->args[0]; INT32 bossid = mo->thing_args[0];
// Stop exploding and prepare to run. // Stop exploding and prepare to run.
P_SetMobjState(mo, mo->info->xdeathstate); P_SetMobjState(mo, mo->info->xdeathstate);
@ -3504,7 +3504,7 @@ void A_BossDeath(mobj_t *mo)
if (LUA_CallAction(A_BOSSDEATH, mo)) if (LUA_CallAction(A_BOSSDEATH, mo))
return; return;
P_LinedefExecute(mo->args[2], mo, NULL); P_LinedefExecute(mo->thing_args[2], mo, NULL);
mo->health = 0; mo->health = 0;
// Boss is dead (but not necessarily fleeing...) // Boss is dead (but not necessarily fleeing...)
@ -4079,8 +4079,8 @@ void A_FishJump(mobj_t *actor)
jumpval = locvar1; jumpval = locvar1;
else else
{ {
if (actor->args[0]) if (actor->thing_args[0])
jumpval = actor->args[0]; jumpval = actor->thing_args[0];
else else
jumpval = 44; jumpval = 44;
} }
@ -5089,16 +5089,16 @@ void A_RockSpawn(mobj_t *actor)
if (LUA_CallAction(A_ROCKSPAWN, actor)) if (LUA_CallAction(A_ROCKSPAWN, actor))
return; return;
type = actor->stringargs[0] ? get_number(actor->stringargs[0]) : MT_ROCKCRUMBLE1; type = actor->thing_stringargs[0] ? get_number(actor->thing_stringargs[0]) : MT_ROCKCRUMBLE1;
if (type < MT_NULL || type >= NUMMOBJTYPES) if (type < MT_NULL || type >= NUMMOBJTYPES)
{ {
CONS_Debug(DBG_GAMELOGIC, "A_RockSpawn: Invalid mobj type %s!\n", actor->stringargs[0]); CONS_Debug(DBG_GAMELOGIC, "A_RockSpawn: Invalid mobj type %s!\n", actor->thing_stringargs[0]);
return; return;
} }
dist = max(actor->args[0] << (FRACBITS - 4), 1); dist = max(actor->thing_args[0] << (FRACBITS - 4), 1);
if (actor->args[2]) if (actor->thing_args[2])
dist += P_RandomByte(PR_UNDEFINED) * (FRACUNIT/32); // random oomph dist += P_RandomByte(PR_UNDEFINED) * (FRACUNIT/32); // random oomph
mo = P_SpawnMobj(actor->x, actor->y, actor->z, MT_FALLINGROCK); mo = P_SpawnMobj(actor->x, actor->y, actor->z, MT_FALLINGROCK);
@ -5108,7 +5108,7 @@ void A_RockSpawn(mobj_t *actor)
P_InstaThrust(mo, mo->angle, dist); P_InstaThrust(mo, mo->angle, dist);
mo->momz = dist; mo->momz = dist;
var1 = actor->args[1]; var1 = actor->thing_args[1];
A_SetTics(actor); A_SetTics(actor);
} }
@ -5770,7 +5770,7 @@ void A_Boss1Chase(mobj_t *actor)
} }
else else
{ {
P_LinedefExecute(actor->args[4], actor, NULL); P_LinedefExecute(actor->thing_args[4], actor, NULL);
P_SetMobjState(actor, actor->info->raisestate); P_SetMobjState(actor, actor->info->raisestate);
} }
@ -6467,7 +6467,7 @@ void A_GuardChase(mobj_t *actor)
false, NULL) false, NULL)
&& speed > 0) // can't be the same check as previous so that P_TryMove gets to happen. && speed > 0) // can't be the same check as previous so that P_TryMove gets to happen.
{ {
INT32 direction = actor->args[0]; INT32 direction = actor->thing_args[0];
switch (direction) switch (direction)
{ {
@ -6734,7 +6734,7 @@ void A_Boss3Path(mobj_t *actor)
continue; continue;
if (mo2->type != MT_BOSS3WAYPOINT) if (mo2->type != MT_BOSS3WAYPOINT)
continue; continue;
if (mapthings[i].args[0] != actor->threshold) if (mapthings[i].thing_args[0] != actor->threshold)
continue; continue;
P_SetTarget(&actor->target, mo2); P_SetTarget(&actor->target, mo2);
@ -6902,13 +6902,13 @@ void A_LinedefExecuteFromArg(mobj_t *actor)
if (LUA_CallAction(A_LINEDEFEXECUTEFROMARG, actor)) if (LUA_CallAction(A_LINEDEFEXECUTEFROMARG, actor))
return; return;
if (locvar1 < 0 || locvar1 > NUMMAPTHINGARGS) if (locvar1 < 0 || locvar1 > NUM_MAPTHING_ARGS)
{ {
CONS_Debug(DBG_GAMELOGIC, "A_LinedefExecuteFromArg: Invalid mapthing arg %d\n", locvar1); CONS_Debug(DBG_GAMELOGIC, "A_LinedefExecuteFromArg: Invalid mapthing arg %d\n", locvar1);
return; return;
} }
tagnum = actor->args[locvar1]; tagnum = actor->thing_args[locvar1];
CONS_Debug(DBG_GAMELOGIC, "A_LinedefExecuteFromArg: Running mobjtype %d's sector with tag %d\n", actor->type, tagnum); CONS_Debug(DBG_GAMELOGIC, "A_LinedefExecuteFromArg: Running mobjtype %d's sector with tag %d\n", actor->type, tagnum);
@ -7927,7 +7927,7 @@ void A_StateRangeByParameter(mobj_t *actor)
if (udmf) if (udmf)
{ {
parameter = actor->args[0]; parameter = actor->thing_args[0];
} }
else if (actor->spawnpoint != NULL) else if (actor->spawnpoint != NULL)
{ {
@ -10371,14 +10371,14 @@ void A_FlickyCenter(mobj_t *actor)
P_SetTarget(&actor->tracer, flicky); P_SetTarget(&actor->tracer, flicky);
actor->flags &= ~(MF_SLIDEME|MF_GRENADEBOUNCE|MF_NOCLIPTHING); actor->flags &= ~(MF_SLIDEME|MF_GRENADEBOUNCE|MF_NOCLIPTHING);
if (actor->args[1] & TMFF_AIMLESS) if (actor->thing_args[1] & TMFF_AIMLESS)
actor->flags |= MF_SLIDEME; actor->flags |= MF_SLIDEME;
if (actor->args[1] & TMFF_STATIONARY) if (actor->thing_args[1] & TMFF_STATIONARY)
actor->flags |= MF_GRENADEBOUNCE; actor->flags |= MF_GRENADEBOUNCE;
if (actor->args[1] & TMFF_HOP) if (actor->thing_args[1] & TMFF_HOP)
actor->flags |= MF_NOCLIPTHING; actor->flags |= MF_NOCLIPTHING;
actor->extravalue1 = actor->args[0] ? abs(actor->args[0])*actor->scale : homeRadius; actor->extravalue1 = actor->thing_args[0] ? abs(actor->thing_args[0])*actor->scale : homeRadius;
actor->extravalue2 = actor->args[2]; actor->extravalue2 = actor->thing_args[2];
actor->friction = actor->x; actor->friction = actor->x;
actor->movefactor = actor->y; actor->movefactor = actor->y;
actor->watertop = actor->z; actor->watertop = actor->z;
@ -11299,7 +11299,7 @@ void A_Boss5FindWaypoint(mobj_t *actor)
INT32 locvar1 = var1; INT32 locvar1 = var1;
boolean avoidcenter; boolean avoidcenter;
INT32 i; INT32 i;
INT32 bossid = actor->args[0]; INT32 bossid = actor->thing_args[0];
if (LUA_CallAction(A_BOSS5FINDWAYPOINT, actor)) if (LUA_CallAction(A_BOSS5FINDWAYPOINT, actor))
return; return;
@ -11326,7 +11326,7 @@ void A_Boss5FindWaypoint(mobj_t *actor)
continue; continue;
if (mapthings[i].mobj->type != MT_FANGWAYPOINT) if (mapthings[i].mobj->type != MT_FANGWAYPOINT)
continue; continue;
if (!(mapthings[i].args[0])) if (!(mapthings[i].thing_args[0]))
continue; continue;
P_SetTarget(&actor->tracer, mapthings[i].mobj); P_SetTarget(&actor->tracer, mapthings[i].mobj);
@ -11355,7 +11355,7 @@ void A_Boss5FindWaypoint(mobj_t *actor)
continue; continue;
if (actor->tracer == mapthings[i].mobj) // this was your tracer last time if (actor->tracer == mapthings[i].mobj) // this was your tracer last time
continue; continue;
if (mapthings[i].args[0]) if (mapthings[i].thing_args[0])
{ {
if (avoidcenter) if (avoidcenter)
continue; continue;
@ -11410,7 +11410,7 @@ void A_Boss5FindWaypoint(mobj_t *actor)
continue; continue;
if (actor->tracer == mapthings[i].mobj) // this was your tracer last time if (actor->tracer == mapthings[i].mobj) // this was your tracer last time
continue; continue;
if (mapthings[i].args[0]) if (mapthings[i].thing_args[0])
{ {
if (avoidcenter) if (avoidcenter)
continue; continue;
@ -12682,7 +12682,7 @@ void A_SpawnPterabytes(mobj_t *actor)
if (LUA_CallAction(A_SPAWNPTERABYTES, actor)) if (LUA_CallAction(A_SPAWNPTERABYTES, actor))
return; return;
amount = min(1, actor->args[0]); amount = min(1, actor->thing_args[0]);
interval = FixedAngle(FRACUNIT*360/amount); interval = FixedAngle(FRACUNIT*360/amount);
@ -13322,11 +13322,11 @@ void A_MayonakaArrow(mobj_t *actor)
if (LUA_CallAction(A_MAYONAKAARROW, (actor))) if (LUA_CallAction(A_MAYONAKAARROW, (actor)))
return; return;
iswarning = (actor->args[0] == TMMA_WARN); // is our object a warning sign? iswarning = (actor->thing_args[0] == TMMA_WARN); // is our object a warning sign?
// "animtimer" is replaced by "extravalue1" here. // "animtimer" is replaced by "extravalue1" here.
actor->extravalue1 = ((actor->extravalue1) ? (actor->extravalue1+1) : (P_RandomRange(PR_DECORATION, 0, (iswarning) ? (TICRATE/2) : TICRATE*3))); actor->extravalue1 = ((actor->extravalue1) ? (actor->extravalue1+1) : (P_RandomRange(PR_DECORATION, 0, (iswarning) ? (TICRATE/2) : TICRATE*3)));
flip = ((actor->args[0] == TMMA_FLIP) ? (3) : (0)); // flip adds 3 frames, which is the flipped version of the sign. flip = ((actor->thing_args[0] == TMMA_FLIP) ? (3) : (0)); // flip adds 3 frames, which is the flipped version of the sign.
// special warning behavior: // special warning behavior:
if (iswarning) if (iswarning)
flip = 6; flip = 6;

View file

@ -686,7 +686,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return; return;
case MT_STARPOST: case MT_STARPOST:
P_TouchStarPost(special, player, special->args[1]); P_TouchStarPost(special, player, special->thing_args[1]);
return; return;
case MT_BIGTUMBLEWEED: case MT_BIGTUMBLEWEED:

View file

@ -527,7 +527,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
if (object->eflags & MFE_SPRUNG) if (object->eflags & MFE_SPRUNG)
break; break;
if (spring->args[1]) if (spring->thing_args[1])
{ {
if (object->player) if (object->player)
{ {

View file

@ -4436,7 +4436,7 @@ static void P_RefreshItemCapsuleParts(mobj_t *mobj)
color = SKINCOLOR_GOLD; color = SKINCOLOR_GOLD;
newRenderFlags |= RF_SEMIBRIGHT; newRenderFlags |= RF_SEMIBRIGHT;
} }
else if (mobj->args[3] & TMICM_TIMEATTACK) else if (mobj->thing_args[3] & TMICM_TIMEATTACK)
color = SKINCOLOR_SAPPHIRE; color = SKINCOLOR_SAPPHIRE;
else if (itemType == KITEM_SPB) else if (itemType == KITEM_SPB)
color = SKINCOLOR_JET; color = SKINCOLOR_JET;
@ -6539,7 +6539,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
if (!(leveltime % 10)) if (!(leveltime % 10))
{ {
mobj_t *smok = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_PETSMOKE); mobj_t *smok = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_PETSMOKE);
if (mobj->args[0]) if (mobj->thing_args[0])
P_SetMobjStateNF(smok, smok->info->painstate); // same function, diff sprite P_SetMobjStateNF(smok, smok->info->painstate); // same function, diff sprite
} }
break; break;
@ -9735,7 +9735,7 @@ static boolean P_FuseThink(mobj_t *mobj)
case MT_SPIKE: case MT_SPIKE:
case MT_WALLSPIKE: case MT_WALLSPIKE:
P_SetMobjState(mobj, mobj->state->nextstate); P_SetMobjState(mobj, mobj->state->nextstate);
mobj->fuse = mobj->args[0]; mobj->fuse = mobj->thing_args[0];
break; break;
case MT_LAVAFALL: case MT_LAVAFALL:
if (mobj->state - states == S_LAVAFALL_DORMANT) if (mobj->state - states == S_LAVAFALL_DORMANT)
@ -9872,7 +9872,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->flags & MF_NOTHINK) if (mobj->flags & MF_NOTHINK)
return; return;
if ((mobj->flags & MF_BOSS) && (bossdisabled & (1 << mobj->args[0]))) if ((mobj->flags & MF_BOSS) && (bossdisabled & (1 << mobj->thing_args[0])))
return; return;
mobj->flags2 &= ~(MF2_ALREADYHIT); mobj->flags2 &= ~(MF2_ALREADYHIT);
@ -12086,7 +12086,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
// Setting the spawnpoint's args[0] will make the player start on the ceiling // Setting the spawnpoint's args[0] will make the player start on the ceiling
// Objectflip inverts // Objectflip inverts
if (!!(mthing->args[0]) ^ !!(mthing->options & MTF_OBJECTFLIP)) if (!!(mthing->thing_args[0]) ^ !!(mthing->options & MTF_OBJECTFLIP))
z = ceilingspawn - offset; z = ceilingspawn - offset;
else else
z = floor + offset; z = floor + offset;
@ -12097,7 +12097,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
mobj->flags2 |= MF2_OBJECTFLIP; mobj->flags2 |= MF2_OBJECTFLIP;
} }
if (mthing->args[0]) if (mthing->thing_args[0])
P_SetPlayerMobjState(mobj, S_KART_SPINOUT); P_SetPlayerMobjState(mobj, S_KART_SPINOUT);
} }
else else
@ -12219,7 +12219,7 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt
case MT_YELLOWHORIZ: case MT_YELLOWHORIZ:
case MT_REDHORIZ: case MT_REDHORIZ:
case MT_BLUEHORIZ: case MT_BLUEHORIZ:
offset += mthing->args[0] ? 0 : 16*FRACUNIT; offset += mthing->thing_args[0] ? 0 : 16*FRACUNIT;
break; break;
// Ring-like items, float additional units unless args[0] is set. // Ring-like items, float additional units unless args[0] is set.
@ -12228,7 +12228,7 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt
case MT_SPRAYCAN: case MT_SPRAYCAN:
case MT_RING: case MT_RING:
case MT_BLUESPHERE: case MT_BLUESPHERE:
offset += mthing->args[0] ? 0 : 24*FRACUNIT; offset += mthing->thing_args[0] ? 0 : 24*FRACUNIT;
break; break;
// This object does not have an offset // This object does not have an offset
@ -12475,15 +12475,15 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj)
mobjeflag_t meflagsapply; mobjeflag_t meflagsapply;
const size_t mthingi = (size_t)(mthing - mapthings); const size_t mthingi = (size_t)(mthing - mapthings);
mlength = abs(mthing->args[0]); mlength = abs(mthing->thing_args[0]);
mnumspokes = mthing->args[1] + 1; mnumspokes = mthing->thing_args[1] + 1;
mspokeangle = FixedAngle((360*FRACUNIT)/mnumspokes) >> ANGLETOFINESHIFT; mspokeangle = FixedAngle((360*FRACUNIT)/mnumspokes) >> ANGLETOFINESHIFT;
mwidth = max(0, mthing->args[2]); mwidth = max(0, mthing->thing_args[2]);
mspeed = abs(mthing->args[3] << 4); mspeed = abs(mthing->thing_args[3] << 4);
mphase = mthing->args[4] % 360; mphase = mthing->thing_args[4] % 360;
mpinch = mthing->args[5] % 360; mpinch = mthing->thing_args[5] % 360;
mnumnospokes = mthing->args[6]; mnumnospokes = mthing->thing_args[6];
mminlength = max(0, min(mlength - 1, mthing->args[7])); mminlength = max(0, min(mlength - 1, mthing->thing_args[7]));
mpitch = mthing->pitch % 360; mpitch = mthing->pitch % 360;
myaw = mthing->angle % 360; myaw = mthing->angle % 360;
mroll = mthing->roll % 360; mroll = mthing->roll % 360;
@ -12516,23 +12516,23 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj)
switch (mobj->type) switch (mobj->type)
{ {
case MT_SPRINGBALLPOINT: case MT_SPRINGBALLPOINT:
macetype = ((mthing->args[8] & TMM_DOUBLESIZE) macetype = ((mthing->thing_args[8] & TMM_DOUBLESIZE)
? MT_REDSPRINGBALL ? MT_REDSPRINGBALL
: MT_YELLOWSPRINGBALL); : MT_YELLOWSPRINGBALL);
chainlink = MT_SMALLMACECHAIN; chainlink = MT_SMALLMACECHAIN;
break; break;
case MT_FIREBARPOINT: case MT_FIREBARPOINT:
macetype = ((mthing->args[8] & TMM_DOUBLESIZE) macetype = ((mthing->thing_args[8] & TMM_DOUBLESIZE)
? MT_BIGFIREBAR ? MT_BIGFIREBAR
: MT_SMALLFIREBAR); : MT_SMALLFIREBAR);
chainlink = MT_NULL; chainlink = MT_NULL;
break; break;
case MT_CUSTOMMACEPOINT: case MT_CUSTOMMACEPOINT:
macetype = mthing->stringargs[0] ? get_number(mthing->stringargs[0]) : MT_NULL; macetype = mthing->thing_stringargs[0] ? get_number(mthing->thing_stringargs[0]) : MT_NULL;
chainlink = mthing->stringargs[1] ? get_number(mthing->stringargs[1]) : MT_NULL; chainlink = mthing->thing_stringargs[1] ? get_number(mthing->thing_stringargs[1]) : MT_NULL;
break; break;
case MT_CHAINPOINT: case MT_CHAINPOINT:
if (mthing->args[8] & TMM_DOUBLESIZE) if (mthing->thing_args[8] & TMM_DOUBLESIZE)
{ {
macetype = MT_BIGGRABCHAIN; macetype = MT_BIGGRABCHAIN;
chainlink = MT_BIGMACECHAIN; chainlink = MT_BIGMACECHAIN;
@ -12545,7 +12545,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj)
mchainlike = true; mchainlike = true;
break; break;
default: default:
if (mthing->args[8] & TMM_DOUBLESIZE) if (mthing->thing_args[8] & TMM_DOUBLESIZE)
{ {
macetype = MT_BIGMACE; macetype = MT_BIGMACE;
chainlink = MT_BIGMACECHAIN; chainlink = MT_BIGMACECHAIN;
@ -12572,11 +12572,11 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj)
firsttype = macetype; firsttype = macetype;
// Adjustable direction // Adjustable direction
if (mthing->args[8] & TMM_ALLOWYAWCONTROL) if (mthing->thing_args[8] & TMM_ALLOWYAWCONTROL)
mobj->flags |= MF_SLIDEME; mobj->flags |= MF_SLIDEME;
// Swinging // Swinging
if (mthing->args[8] & TMM_SWING) if (mthing->thing_args[8] & TMM_SWING)
{ {
mobj->flags2 |= MF2_STRONGBOX; mobj->flags2 |= MF2_STRONGBOX;
mmin = ((mnumnospokes > 1) ? 1 : 0); mmin = ((mnumnospokes > 1) ? 1 : 0);
@ -12585,11 +12585,11 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj)
mmin = mnumspokes; mmin = mnumspokes;
// If over distance away, don't move UNLESS this flag is applied // If over distance away, don't move UNLESS this flag is applied
if (mthing->args[8] & TMM_ALWAYSTHINK) if (mthing->thing_args[8] & TMM_ALWAYSTHINK)
mobj->flags2 |= MF2_BOSSNOTRAP; mobj->flags2 |= MF2_BOSSNOTRAP;
// Make the links the same type as the end - repeated below // Make the links the same type as the end - repeated below
if ((mobj->type != MT_CHAINPOINT) && (((mthing->args[8] & TMM_MACELINKS) == TMM_MACELINKS) != (mobj->type == MT_FIREBARPOINT))) // exclusive or if ((mobj->type != MT_CHAINPOINT) && (((mthing->thing_args[8] & TMM_MACELINKS) == TMM_MACELINKS) != (mobj->type == MT_FIREBARPOINT))) // exclusive or
{ {
linktype = macetype; linktype = macetype;
radiusfactor = 2; // Double the radius. radiusfactor = 2; // Double the radius.
@ -12601,7 +12601,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj)
mchainlike = (firsttype == chainlink); mchainlike = (firsttype == chainlink);
widthfactor = (mchainlike ? 1 : 2); widthfactor = (mchainlike ? 1 : 2);
mflagsapply = (mthing->args[8] & TMM_CLIP) ? 0 : (MF_NOCLIP|MF_NOCLIPHEIGHT); mflagsapply = (mthing->thing_args[8] & TMM_CLIP) ? 0 : (MF_NOCLIP|MF_NOCLIPHEIGHT);
mflags2apply = ((mthing->options & MTF_OBJECTFLIP) ? MF2_OBJECTFLIP : 0); mflags2apply = ((mthing->options & MTF_OBJECTFLIP) ? MF2_OBJECTFLIP : 0);
meflagsapply = ((mthing->options & MTF_OBJECTFLIP) ? MFE_VERTICALFLIP : 0); meflagsapply = ((mthing->options & MTF_OBJECTFLIP) ? MFE_VERTICALFLIP : 0);
@ -12627,14 +12627,14 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj)
hprev = spawnee;\ hprev = spawnee;\
} }
mdosound = (mspeed && !(mthing->args[8] & TMM_SILENT)); mdosound = (mspeed && !(mthing->thing_args[8] & TMM_SILENT));
mdocenter = (macetype && (mthing->args[8] & TMM_CENTERLINK)); mdocenter = (macetype && (mthing->thing_args[8] & TMM_CENTERLINK));
// The actual spawning of spokes // The actual spawning of spokes
while (mnumspokes-- > 0) while (mnumspokes-- > 0)
{ {
// Offsets // Offsets
if (mthing->args[8] & TMM_SWING) // Swinging if (mthing->thing_args[8] & TMM_SWING) // Swinging
mroll = (mroll - mspokeangle) & FINEMASK; mroll = (mroll - mspokeangle) & FINEMASK;
else // Spinning else // Spinning
mphase = (mphase - mspokeangle) & FINEMASK; mphase = (mphase - mspokeangle) & FINEMASK;
@ -12645,7 +12645,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj)
continue; continue;
linktype = chainlink; linktype = chainlink;
firsttype = ((mthing->args[8] & TMM_DOUBLESIZE) ? MT_BIGGRABCHAIN : MT_SMALLGRABCHAIN); firsttype = ((mthing->thing_args[8] & TMM_DOUBLESIZE) ? MT_BIGGRABCHAIN : MT_SMALLGRABCHAIN);
mmaxlength = 1 + (mlength - 1) * radiusfactor; mmaxlength = 1 + (mlength - 1) * radiusfactor;
radiusfactor = widthfactor = 1; radiusfactor = widthfactor = 1;
} }
@ -12654,7 +12654,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj)
if (mobj->type == MT_CHAINMACEPOINT) if (mobj->type == MT_CHAINMACEPOINT)
{ {
// Make the links the same type as the end - repeated above // Make the links the same type as the end - repeated above
if (mthing->args[8] & TMM_MACELINKS) if (mthing->thing_args[8] & TMM_MACELINKS)
{ {
linktype = macetype; linktype = macetype;
radiusfactor = 2; radiusfactor = 2;
@ -12744,20 +12744,20 @@ static boolean P_SetupParticleGen(mapthing_t *mthing, mobj_t *mobj)
const size_t mthingi = (size_t)(mthing - mapthings); const size_t mthingi = (size_t)(mthing - mapthings);
// Find the corresponding linedef special, using args[6] as tag // Find the corresponding linedef special, using args[6] as tag
line = mthing->args[6] ? Tag_FindLineSpecial(15, mthing->args[6]) : -1; line = mthing->thing_args[6] ? Tag_FindLineSpecial(15, mthing->thing_args[6]) : -1;
type = mthing->stringargs[0] ? get_number(mthing->stringargs[0]) : MT_PARTICLE; type = mthing->thing_stringargs[0] ? get_number(mthing->thing_stringargs[0]) : MT_PARTICLE;
ticcount = mthing->args[4]; ticcount = mthing->thing_args[4];
if (ticcount < 1) if (ticcount < 1)
ticcount = 3; ticcount = 3;
numdivisions = mthing->args[0]; numdivisions = mthing->thing_args[0];
if (numdivisions) if (numdivisions)
{ {
radius = mthing->args[1] << FRACBITS; radius = mthing->thing_args[1] << FRACBITS;
anglespeed = (mthing->args[3]) % 360; anglespeed = (mthing->thing_args[3]) % 360;
angledivision = 360/numdivisions; angledivision = 360/numdivisions;
} }
else else
@ -12768,11 +12768,11 @@ static boolean P_SetupParticleGen(mapthing_t *mthing, mobj_t *mobj)
angledivision = 0; angledivision = 0;
} }
speed = abs(mthing->args[2]) << FRACBITS; speed = abs(mthing->thing_args[2]) << FRACBITS;
if (mthing->options & MTF_OBJECTFLIP) if (mthing->options & MTF_OBJECTFLIP)
speed *= -1; speed *= -1;
zdist = abs(mthing->args[5]) << FRACBITS; zdist = abs(mthing->thing_args[5]) << FRACBITS;
CONS_Debug(DBG_GAMELOGIC, "Particle Generator (mapthing #%s):\n" CONS_Debug(DBG_GAMELOGIC, "Particle Generator (mapthing #%s):\n"
"Radius is %d\n" "Radius is %d\n"
@ -12874,7 +12874,7 @@ void P_InitSkyboxPoint(mobj_t *mobj, mapthing_t *mthing)
return; return;
} }
if (mthing->args[0]) if (mthing->thing_args[0])
P_SetTarget(&skyboxcenterpnts[tag], mobj); P_SetTarget(&skyboxcenterpnts[tag], mobj);
else else
P_SetTarget(&skyboxviewpnts[tag], mobj); P_SetTarget(&skyboxviewpnts[tag], mobj);
@ -12946,14 +12946,14 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
break; break;
} }
case MT_EGGSTATUE: case MT_EGGSTATUE:
if (mthing->args[1]) if (mthing->thing_args[1])
{ {
mobj->color = SKINCOLOR_GOLD; mobj->color = SKINCOLOR_GOLD;
mobj->colorized = true; mobj->colorized = true;
} }
break; break;
case MT_FAN: case MT_FAN:
if (mthing->args[1] & TMF_INVISIBLE) if (mthing->thing_args[1] & TMF_INVISIBLE)
{ {
P_UnsetThingPosition(mobj); P_UnsetThingPosition(mobj);
if (sector_list) if (sector_list)
@ -12964,21 +12964,21 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
mobj->flags |= MF_NOSECTOR; // this flag basically turns it invisible mobj->flags |= MF_NOSECTOR; // this flag basically turns it invisible
P_SetThingPosition(mobj); P_SetThingPosition(mobj);
} }
if (mthing->args[1] & TMF_NODISTANCECHECK) if (mthing->thing_args[1] & TMF_NODISTANCECHECK)
mobj->flags2 |= MF2_AMBUSH; mobj->flags2 |= MF2_AMBUSH;
if (mthing->args[0]) if (mthing->thing_args[0])
mobj->health = mthing->args[0]; mobj->health = mthing->thing_args[0];
else else
mobj->health = FixedMul(mobj->subsector->sector->ceilingheight - mobj->subsector->sector->floorheight, 3*(FRACUNIT/4)) >> FRACBITS; mobj->health = FixedMul(mobj->subsector->sector->ceilingheight - mobj->subsector->sector->floorheight, 3*(FRACUNIT/4)) >> FRACBITS;
break; break;
case MT_BALLOON: case MT_BALLOON:
if (mthing->stringargs[0]) if (mthing->thing_stringargs[0])
mobj->color = get_number(mthing->stringargs[0]); mobj->color = get_number(mthing->thing_stringargs[0]);
if (mthing->args[0]) if (mthing->thing_args[0])
mobj->flags2 |= MF2_AMBUSH; mobj->flags2 |= MF2_AMBUSH;
break; break;
case MT_FLAME: case MT_FLAME:
if (mthing->args[0]) if (mthing->thing_args[0])
{ {
mobj_t *corona = P_MakeSoftwareCorona(mobj, 20); mobj_t *corona = P_MakeSoftwareCorona(mobj, 20);
P_SetScale(corona, (corona->destscale = mobj->scale*3)); P_SetScale(corona, (corona->destscale = mobj->scale*3));
@ -12986,12 +12986,12 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
} }
break; break;
case MT_FLAMEHOLDER: case MT_FLAMEHOLDER:
if (!(mthing->args[0] & TMFH_NOFLAME)) // Spawn the fire if (!(mthing->thing_args[0] & TMFH_NOFLAME)) // Spawn the fire
{ {
mobj_t *flame = P_SpawnMobjFromMobj(mobj, 0, 0, mobj->height, MT_FLAME); mobj_t *flame = P_SpawnMobjFromMobj(mobj, 0, 0, mobj->height, MT_FLAME);
P_SetTarget(&flame->target, mobj); P_SetTarget(&flame->target, mobj);
flame->flags2 |= MF2_BOSSNOTRAP; flame->flags2 |= MF2_BOSSNOTRAP;
if (mthing->args[0] & TMFH_CORONA) if (mthing->thing_args[0] & TMFH_CORONA)
{ {
mobj_t *corona = P_MakeSoftwareCorona(flame, 20); mobj_t *corona = P_MakeSoftwareCorona(flame, 20);
P_SetScale(corona, (corona->destscale = flame->scale*3)); P_SetScale(corona, (corona->destscale = flame->scale*3));
@ -13001,13 +13001,13 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
break; break;
case MT_CANDLE: case MT_CANDLE:
case MT_CANDLEPRICKET: case MT_CANDLEPRICKET:
if (mthing->args[0]) if (mthing->thing_args[0])
P_MakeSoftwareCorona(mobj, ((mobj->type == MT_CANDLE) ? 42 : 176)); P_MakeSoftwareCorona(mobj, ((mobj->type == MT_CANDLE) ? 42 : 176));
break; break;
case MT_JACKO1: case MT_JACKO1:
case MT_JACKO2: case MT_JACKO2:
case MT_JACKO3: case MT_JACKO3:
if (!(mthing->args[0])) // take the torch out of the crafting recipe if (!(mthing->thing_args[0])) // take the torch out of the crafting recipe
{ {
mobj_t *overlay = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_OVERLAY); mobj_t *overlay = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_OVERLAY);
P_SetTarget(&overlay->target, mobj); P_SetTarget(&overlay->target, mobj);
@ -13015,14 +13015,14 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
} }
break; break;
case MT_WATERDRIP: case MT_WATERDRIP:
mobj->tics = 3*TICRATE + mthing->args[0]; mobj->tics = 3*TICRATE + mthing->thing_args[0];
break; break;
case MT_FLAMEJET: case MT_FLAMEJET:
case MT_VERTICALFLAMEJET: case MT_VERTICALFLAMEJET:
mobj->movecount = mthing->args[0]; mobj->movecount = mthing->thing_args[0];
mobj->threshold = mthing->args[1]; mobj->threshold = mthing->thing_args[1];
mobj->movedir = mthing->args[2]; mobj->movedir = mthing->thing_args[2];
if (mthing->args[3]) if (mthing->thing_args[3])
mobj->flags2 |= MF2_AMBUSH; mobj->flags2 |= MF2_AMBUSH;
break; break;
case MT_MACEPOINT: case MT_MACEPOINT:
@ -13040,8 +13040,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
break; break;
case MT_TUBEWAYPOINT: case MT_TUBEWAYPOINT:
{ {
UINT8 sequence = mthing->args[0]; UINT8 sequence = mthing->thing_args[0];
UINT8 id = mthing->args[1]; UINT8 id = mthing->thing_args[1];
mobj->health = id; mobj->health = id;
mobj->threshold = sequence; mobj->threshold = sequence;
P_AddTubeWaypoint(sequence, id, mobj); P_AddTubeWaypoint(sequence, id, mobj);
@ -13050,7 +13050,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
case MT_DSZSTALAGMITE: case MT_DSZSTALAGMITE:
case MT_DSZ2STALAGMITE: case MT_DSZ2STALAGMITE:
case MT_KELP: case MT_KELP:
if (mthing->args[0]) { // make mobj twice as big as normal if (mthing->thing_args[0]) { // make mobj twice as big as normal
P_SetScale(mobj, 2*mobj->scale); // not 2*FRACUNIT in case of something like the old ERZ3 mode P_SetScale(mobj, 2*mobj->scale); // not 2*FRACUNIT in case of something like the old ERZ3 mode
mobj->destscale = mobj->scale; mobj->destscale = mobj->scale;
} }
@ -13090,8 +13090,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
} }
break; break;
case MT_SMASHINGSPIKEBALL: case MT_SMASHINGSPIKEBALL:
if (mthing->args[0] > 0) if (mthing->thing_args[0] > 0)
mobj->tics += mthing->args[0]; mobj->tics += mthing->thing_args[0];
break; break;
case MT_BIGFERN: case MT_BIGFERN:
{ {
@ -13115,37 +13115,37 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
break; break;
case MT_AXIS: case MT_AXIS:
// Inverted if args[3] is set // Inverted if args[3] is set
if (mthing->args[3]) if (mthing->thing_args[3])
mobj->flags2 |= MF2_AMBUSH; mobj->flags2 |= MF2_AMBUSH;
mobj->radius = abs(mthing->args[2]) << FRACBITS; mobj->radius = abs(mthing->thing_args[2]) << FRACBITS;
// FALLTHRU // FALLTHRU
case MT_AXISTRANSFER: case MT_AXISTRANSFER:
case MT_AXISTRANSFERLINE: case MT_AXISTRANSFERLINE:
// Mare it belongs to // Mare it belongs to
mobj->threshold = min(mthing->args[0], 7); mobj->threshold = min(mthing->thing_args[0], 7);
// # in the mare // # in the mare
mobj->health = mthing->args[1]; mobj->health = mthing->thing_args[1];
mobj->flags2 |= MF2_AXIS; mobj->flags2 |= MF2_AXIS;
break; break;
case MT_STARPOST: case MT_STARPOST:
mobj->health = mthing->args[0] + 1; mobj->health = mthing->thing_args[0] + 1;
if (!P_MapAlreadyHasStarPost(mobj)) if (!P_MapAlreadyHasStarPost(mobj))
numstarposts++; numstarposts++;
break; break;
case MT_SPIKE: case MT_SPIKE:
// Pop up spikes! // Pop up spikes!
if (mthing->args[0]) if (mthing->thing_args[0])
{ {
mobj->flags &= ~MF_SCENERY; mobj->flags &= ~MF_SCENERY;
mobj->fuse = mthing->args[1]; mobj->fuse = mthing->thing_args[1];
} }
if (mthing->args[2] & TMSF_RETRACTED) if (mthing->thing_args[2] & TMSF_RETRACTED)
P_SetMobjState(mobj, mobj->info->meleestate); P_SetMobjState(mobj, mobj->info->meleestate);
// Use per-thing collision for spikes unless the intangible flag is checked. // Use per-thing collision for spikes unless the intangible flag is checked.
if (!(mthing->args[2] & TMSF_INTANGIBLE) && !metalrecording) if (!(mthing->thing_args[2] & TMSF_INTANGIBLE) && !metalrecording)
{ {
P_UnsetThingPosition(mobj); P_UnsetThingPosition(mobj);
mobj->flags &= ~(MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIPHEIGHT); mobj->flags &= ~(MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIPHEIGHT);
@ -13155,15 +13155,15 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
break; break;
case MT_WALLSPIKE: case MT_WALLSPIKE:
// Pop up spikes! // Pop up spikes!
if (mthing->args[0]) if (mthing->thing_args[0])
{ {
mobj->flags &= ~MF_SCENERY; mobj->flags &= ~MF_SCENERY;
mobj->fuse = mthing->args[1]; mobj->fuse = mthing->thing_args[1];
} }
if (mthing->args[2] & TMSF_RETRACTED) if (mthing->thing_args[2] & TMSF_RETRACTED)
P_SetMobjState(mobj, mobj->info->meleestate); P_SetMobjState(mobj, mobj->info->meleestate);
// Use per-thing collision for spikes unless the intangible flag is checked. // Use per-thing collision for spikes unless the intangible flag is checked.
if (!(mthing->args[2] & TMSF_INTANGIBLE) && !metalrecording) if (!(mthing->thing_args[2] & TMSF_INTANGIBLE) && !metalrecording)
{ {
P_UnsetThingPosition(mobj); P_UnsetThingPosition(mobj);
mobj->flags &= ~(MF_NOBLOCKMAP | MF_NOCLIPHEIGHT); mobj->flags &= ~(MF_NOBLOCKMAP | MF_NOCLIPHEIGHT);
@ -13187,7 +13187,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
break; break;
case MT_BIGTUMBLEWEED: case MT_BIGTUMBLEWEED:
case MT_LITTLETUMBLEWEED: case MT_LITTLETUMBLEWEED:
if (mthing->args[0]) if (mthing->thing_args[0])
{ {
fixed_t offset = FixedMul(16*FRACUNIT, mobj->scale); fixed_t offset = FixedMul(16*FRACUNIT, mobj->scale);
mobj->momx += P_RandomChance(PR_DECORATION, FRACUNIT/2) ? offset : -offset; mobj->momx += P_RandomChance(PR_DECORATION, FRACUNIT/2) ? offset : -offset;
@ -13197,9 +13197,9 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
} }
break; break;
case MT_AMBIENT: case MT_AMBIENT:
if (mthing->stringargs[0]) if (mthing->thing_stringargs[0])
mobj->threshold = get_number(mthing->stringargs[0]); mobj->threshold = get_number(mthing->thing_stringargs[0]);
mobj->health = mthing->args[0] ? mthing->args[0] : TICRATE; mobj->health = mthing->thing_args[0] ? mthing->thing_args[0] : TICRATE;
break; break;
// SRB2Kart // SRB2Kart
case MT_WAYPOINT: case MT_WAYPOINT:
@ -13208,8 +13208,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
mapheaderinfo[gamemap-1]->default_waypoint_radius; mapheaderinfo[gamemap-1]->default_waypoint_radius;
mtag_t tag = mthing->tid; mtag_t tag = mthing->tid;
if (mthing->args[1] > 0) if (mthing->thing_args[1] > 0)
mobj->radius = (mthing->args[1]) * FRACUNIT; mobj->radius = (mthing->thing_args[1]) * FRACUNIT;
else if (mobjscale > 0) else if (mobjscale > 0)
mobj->radius = mobjscale; mobj->radius = mobjscale;
else else
@ -13221,9 +13221,9 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
// lastlook is used for indicating the waypoint is a shortcut // lastlook is used for indicating the waypoint is a shortcut
// extravalue1 is used for indicating the waypoint is disabled // extravalue1 is used for indicating the waypoint is disabled
// extravalue2 is used for indicating the waypoint is the finishline // extravalue2 is used for indicating the waypoint is the finishline
mobj->threshold = mthing->args[0]; mobj->threshold = mthing->thing_args[0];
mobj->movecount = tag; mobj->movecount = tag;
if (mthing->args[2] & TMWPF_DISABLED) if (mthing->thing_args[2] & TMWPF_DISABLED)
{ {
mobj->extravalue1 = 0; // The waypoint is disabled if extra is on mobj->extravalue1 = 0; // The waypoint is disabled if extra is on
} }
@ -13231,7 +13231,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
{ {
mobj->extravalue1 = 1; mobj->extravalue1 = 1;
} }
if (mthing->args[2] & TMWPF_SHORTCUT) if (mthing->thing_args[2] & TMWPF_SHORTCUT)
{ {
mobj->lastlook = 1; // the waypoint is a shortcut if objectspecial is on mobj->lastlook = 1; // the waypoint is a shortcut if objectspecial is on
} }
@ -13239,7 +13239,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
{ {
mobj->lastlook = 0; mobj->lastlook = 0;
} }
if (mthing->args[2] & TMWPF_NORESPAWN) if (mthing->thing_args[2] & TMWPF_NORESPAWN)
{ {
mobj->reactiontime = 0; // Can't respawn at if Ambush is on mobj->reactiontime = 0; // Can't respawn at if Ambush is on
} }
@ -13247,7 +13247,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
{ {
mobj->reactiontime = 1; mobj->reactiontime = 1;
} }
if (mthing->args[2] & TMWPF_FINISHLINE) if (mthing->thing_args[2] & TMWPF_FINISHLINE)
{ {
mobj->extravalue2 = 1; // args[2] of 1 means the waypoint is at the finish line mobj->extravalue2 = 1; // args[2] of 1 means the waypoint is at the finish line
mobj->reactiontime = 0; // Also don't respawn at finish lines mobj->reactiontime = 0; // Also don't respawn at finish lines
@ -13267,9 +13267,9 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
case MT_BOTHINT: case MT_BOTHINT:
{ {
// Change size // Change size
if (mthing->args[0] > 0) if (mthing->thing_args[0] > 0)
{ {
mobj->radius = mthing->args[0] * FRACUNIT; mobj->radius = mthing->thing_args[0] * FRACUNIT;
} }
else else
{ {
@ -13277,7 +13277,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
} }
// Steer away instead of towards // Steer away instead of towards
if (mthing->args[2]) if (mthing->thing_args[2])
{ {
mobj->extravalue1 = 0; mobj->extravalue1 = 0;
} }
@ -13287,13 +13287,13 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
} }
// Steering amount // Steering amount
if (mthing->args[1] == 0) if (mthing->thing_args[1] == 0)
{ {
mobj->extravalue2 = 4; mobj->extravalue2 = 4;
} }
else else
{ {
mobj->extravalue2 = mthing->args[1]; mobj->extravalue2 = mthing->thing_args[1];
} }
break; break;
} }
@ -13311,7 +13311,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
P_SetThingPosition(mobj); P_SetThingPosition(mobj);
} }
} }
if (mthing->args[0] == 1) if (mthing->thing_args[0] == 1)
mobj->flags2 |= MF2_AMBUSH; mobj->flags2 |= MF2_AMBUSH;
break; break;
} }
@ -13334,14 +13334,14 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
mobj->flags |= MF_NOGRAVITY; mobj->flags |= MF_NOGRAVITY;
// Angle = item type // Angle = item type
if (mthing->args[0] > 0 && mthing->args[0] < NUMKARTITEMS) if (mthing->thing_args[0] > 0 && mthing->thing_args[0] < NUMKARTITEMS)
mobj->threshold = mthing->args[0]; mobj->threshold = mthing->thing_args[0];
// Parameter = extra items (x5 for rings) // Parameter = extra items (x5 for rings)
mobj->movecount += mthing->args[1]; mobj->movecount += mthing->thing_args[1];
// Ambush = double size (grounded) / half size (aerial) // Ambush = double size (grounded) / half size (aerial)
if (!(mthing->args[2] & TMICF_INVERTSIZE) == !P_IsObjectOnGround(mobj)) if (!(mthing->thing_args[2] & TMICF_INVERTSIZE) == !P_IsObjectOnGround(mobj))
{ {
mobj->extravalue1 = min(mobj->extravalue1 << 1, FixedDiv(MAPBLOCKSIZE, mobj->info->radius)); // don't make them larger than the blockmap can handle mobj->extravalue1 = min(mobj->extravalue1 << 1, FixedDiv(MAPBLOCKSIZE, mobj->info->radius)); // don't make them larger than the blockmap can handle
mobj->scalespeed <<= 1; mobj->scalespeed <<= 1;
@ -13350,17 +13350,17 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
} }
case MT_RANDOMAUDIENCE: case MT_RANDOMAUDIENCE:
{ {
if (mthing->args[2] & TMAUDIM_FLOAT) if (mthing->thing_args[2] & TMAUDIM_FLOAT)
{ {
mobj->flags |= MF_NOGRAVITY; mobj->flags |= MF_NOGRAVITY;
} }
if (mthing->args[2] & TMAUDIM_BORED) if (mthing->thing_args[2] & TMAUDIM_BORED)
{ {
mobj->flags2 |= MF2_BOSSNOTRAP; mobj->flags2 |= MF2_BOSSNOTRAP;
} }
if (mthing->args[3] != 0) if (mthing->thing_args[3] != 0)
{ {
mobj->flags2 |= MF2_AMBUSH; mobj->flags2 |= MF2_AMBUSH;
} }
@ -13376,8 +13376,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
{ {
fixed_t top = mobj->z; fixed_t top = mobj->z;
UINT8 i; UINT8 i;
UINT8 locnumsegs = abs(mthing->args[0])+2; UINT8 locnumsegs = abs(mthing->thing_args[0])+2;
UINT8 numleaves = max(3, (abs(mthing->args[1])+1 % 6) + 3); UINT8 numleaves = max(3, (abs(mthing->thing_args[1])+1 % 6) + 3);
mobj_t *coconut; mobj_t *coconut;
// Spawn tree segments // Spawn tree segments
@ -13413,7 +13413,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
case MT_SUNBEAMPALM_STEM: case MT_SUNBEAMPALM_STEM:
{ {
UINT8 i; UINT8 i;
const UINT8 numleaves = max(4, (abs(mthing->args[0])+1 % 6) + 4); const UINT8 numleaves = max(4, (abs(mthing->thing_args[0])+1 % 6) + 4);
const fixed_t pivot = P_RandomRange(PR_DECORATION, -40, 20) * FRACUNIT; const fixed_t pivot = P_RandomRange(PR_DECORATION, -40, 20) * FRACUNIT;
@ -13515,7 +13515,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
} }
// Moving capsules! // Moving capsules!
if (mthing->args[0] && mthing->args[1]) if (mthing->thing_args[0] && mthing->thing_args[1])
{ {
K_SetupMovingCapsule(mthing, mobj); K_SetupMovingCapsule(mthing, mobj);
} }
@ -13584,7 +13584,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
{ {
Obj_DuelBombInit(mobj); Obj_DuelBombInit(mobj);
if (mthing->args[1]) if (mthing->thing_args[1])
{ {
Obj_DuelBombReverse(mobj); Obj_DuelBombReverse(mobj);
} }
@ -13642,7 +13642,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
if (mobj->flags & MF_BOSS) if (mobj->flags & MF_BOSS)
{ {
if (mthing->args[1]) // No egg trap for this boss if (mthing->thing_args[1]) // No egg trap for this boss
mobj->flags2 |= MF2_BOSSNOTRAP; mobj->flags2 |= MF2_BOSSNOTRAP;
} }
@ -13674,33 +13674,61 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y,
P_SetScale(mobj, FixedMul(mobj->scale, mthing->scale)); P_SetScale(mobj, FixedMul(mobj->scale, mthing->scale));
mobj->destscale = FixedMul(mobj->destscale, mthing->scale); mobj->destscale = FixedMul(mobj->destscale, mthing->scale);
mobj->spritexscale = mthing->spritexscale;
mobj->spriteyscale = mthing->spriteyscale;
P_SetThingTID(mobj, mthing->tid); P_SetThingTID(mobj, mthing->tid);
mobj->special = mthing->special; mobj->special = mthing->special;
for (arg = 0; arg < NUMMAPTHINGARGS; arg++) for (arg = 0; arg < NUM_MAPTHING_ARGS; arg++)
{ {
mobj->args[arg] = mthing->args[arg]; mobj->thing_args[arg] = mthing->thing_args[arg];
} }
for (arg = 0; arg < NUMMAPTHINGSTRINGARGS; arg++) for (arg = 0; arg < NUM_MAPTHING_STRINGARGS; arg++)
{ {
size_t len = 0; size_t len = 0;
if (mthing->stringargs[arg]) if (mthing->thing_stringargs[arg])
{ {
len = strlen(mthing->stringargs[arg]); len = strlen(mthing->thing_stringargs[arg]);
} }
if (len == 0) if (len == 0)
{ {
Z_Free(mobj->stringargs[arg]); Z_Free(mobj->thing_stringargs[arg]);
mobj->stringargs[arg] = NULL; mobj->thing_stringargs[arg] = NULL;
continue; continue;
} }
mobj->stringargs[arg] = Z_Realloc(mobj->stringargs[arg], len + 1, PU_LEVEL, NULL); mobj->thing_stringargs[arg] = Z_Realloc(mobj->thing_stringargs[arg], len + 1, PU_LEVEL, NULL);
M_Memcpy(mobj->stringargs[arg], mthing->stringargs[arg], len + 1); M_Memcpy(mobj->thing_stringargs[arg], mthing->thing_stringargs[arg], len + 1);
}
for (arg = 0; arg < NUM_SCRIPT_ARGS; arg++)
{
mobj->script_args[arg] = mthing->script_args[arg];
}
for (arg = 0; arg < NUM_SCRIPT_STRINGARGS; arg++)
{
size_t len = 0;
if (mthing->script_stringargs[arg])
{
len = strlen(mthing->script_stringargs[arg]);
}
if (len == 0)
{
Z_Free(mobj->script_stringargs[arg]);
mobj->script_stringargs[arg] = NULL;
continue;
}
mobj->script_stringargs[arg] = Z_Realloc(mobj->script_stringargs[arg], len + 1, PU_LEVEL, NULL);
M_Memcpy(mobj->script_stringargs[arg], mthing->script_stringargs[arg], len + 1);
} }
if (!P_SetupSpawnedMapThing(mthing, mobj)) if (!P_SetupSpawnedMapThing(mthing, mobj))
@ -13773,7 +13801,7 @@ void P_SpawnHoop(mapthing_t *mthing)
mobj_t *nextmobj = NULL; mobj_t *nextmobj = NULL;
mobj_t *hoopcenter; mobj_t *hoopcenter;
TMatrix *pitchmatrix, *yawmatrix; TMatrix *pitchmatrix, *yawmatrix;
fixed_t radius = mthing->args[0] << FRACBITS; fixed_t radius = mthing->thing_args[0] << FRACBITS;
fixed_t sizefactor = 4*FRACUNIT; fixed_t sizefactor = 4*FRACUNIT;
fixed_t hoopsize = radius/sizefactor; fixed_t hoopsize = radius/sizefactor;
INT32 i; INT32 i;
@ -13925,7 +13953,7 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 numi
loopanchor->spawnpoint = NULL; loopanchor->spawnpoint = NULL;
Obj_LinkLoopAnchor(loopanchor, loopcenter, mthing->args[0]); Obj_LinkLoopAnchor(loopanchor, loopcenter, mthing->thing_args[0]);
} }
for (r = 0; r < numitems; r++) for (r = 0; r < numitems; r++)
@ -14081,8 +14109,8 @@ void P_SpawnItemPattern(mapthing_t *mthing)
UINT8 numitemtypes; UINT8 numitemtypes;
if (!udmf) if (!udmf)
return; return;
P_ParseItemTypes(mthing->stringargs[0], itemtypes, &numitemtypes); P_ParseItemTypes(mthing->thing_stringargs[0], itemtypes, &numitemtypes);
P_SpawnItemRow(mthing, itemtypes, numitemtypes, mthing->args[0], mthing->args[1] << FRACBITS, mthing->args[2] << FRACBITS, mthing->angle); P_SpawnItemRow(mthing, itemtypes, numitemtypes, mthing->thing_args[0], mthing->thing_args[1] << FRACBITS, mthing->thing_args[2] << FRACBITS, mthing->angle);
return; return;
} }
case 611: // Generic item circle case 611: // Generic item circle
@ -14091,9 +14119,8 @@ void P_SpawnItemPattern(mapthing_t *mthing)
UINT8 numitemtypes; UINT8 numitemtypes;
if (!udmf) if (!udmf)
return; return;
CONS_Printf("Itemstring: %s\n", mthing->stringargs[0]); P_ParseItemTypes(mthing->thing_stringargs[0], itemtypes, &numitemtypes);
P_ParseItemTypes(mthing->stringargs[0], itemtypes, &numitemtypes); P_SpawnItemCircle(mthing, itemtypes, numitemtypes, mthing->thing_args[0], mthing->thing_args[1] << FRACBITS);
P_SpawnItemCircle(mthing, itemtypes, numitemtypes, mthing->args[0], mthing->args[1] << FRACBITS);
return; return;
} }
default: default:
@ -14754,9 +14781,15 @@ void P_DeleteMobjStringArgs(mobj_t *mobj)
{ {
size_t i = SIZE_MAX; size_t i = SIZE_MAX;
for (i = 0; i < NUMMAPTHINGSTRINGARGS; i++) for (i = 0; i < NUM_MAPTHING_STRINGARGS; i++)
{ {
Z_Free(mobj->stringargs[i]); Z_Free(mobj->thing_stringargs[i]);
mobj->stringargs[i] = NULL; mobj->thing_stringargs[i] = NULL;
}
for (i = 0; i < NUM_SCRIPT_STRINGARGS; i++)
{
Z_Free(mobj->script_stringargs[i]);
mobj->script_stringargs[i] = NULL;
} }
} }

View file

@ -426,9 +426,12 @@ struct mobj_t
INT32 dispoffset; INT32 dispoffset;
INT32 thing_args[NUM_MAPTHING_ARGS];
char *thing_stringargs[NUM_MAPTHING_STRINGARGS];
INT16 special; INT16 special;
INT32 args[NUMMAPTHINGARGS]; INT32 script_args[NUM_SCRIPT_ARGS];
char *stringargs[NUMMAPTHINGSTRINGARGS]; char *script_stringargs[NUM_SCRIPT_STRINGARGS];
// WARNING: New fields must be added separately to savegame and Lua. // WARNING: New fields must be added separately to savegame and Lua.
}; };

View file

@ -1549,7 +1549,7 @@ static void P_NetUnArchiveColormaps(savebuffer_t *save)
static boolean P_SectorArgsEqual(const sector_t *sc, const sector_t *spawnsc) static boolean P_SectorArgsEqual(const sector_t *sc, const sector_t *spawnsc)
{ {
UINT8 i; UINT8 i;
for (i = 0; i < NUMSECTORARGS; i++) for (i = 0; i < NUM_SCRIPT_ARGS; i++)
if (sc->args[i] != spawnsc->args[i]) if (sc->args[i] != spawnsc->args[i])
return false; return false;
@ -1559,7 +1559,7 @@ static boolean P_SectorArgsEqual(const sector_t *sc, const sector_t *spawnsc)
static boolean P_SectorStringArgsEqual(const sector_t *sc, const sector_t *spawnsc) static boolean P_SectorStringArgsEqual(const sector_t *sc, const sector_t *spawnsc)
{ {
UINT8 i; UINT8 i;
for (i = 0; i < NUMSECTORSTRINGARGS; i++) for (i = 0; i < NUM_SCRIPT_STRINGARGS; i++)
{ {
if (!sc->stringargs[i]) if (!sc->stringargs[i])
return !spawnsc->stringargs[i]; return !spawnsc->stringargs[i];
@ -1596,7 +1596,7 @@ static boolean P_SectorStringArgsEqual(const sector_t *sc, const sector_t *spawn
static boolean P_LineArgsEqual(const line_t *li, const line_t *spawnli) static boolean P_LineArgsEqual(const line_t *li, const line_t *spawnli)
{ {
UINT8 i; UINT8 i;
for (i = 0; i < NUMLINEARGS; i++) for (i = 0; i < NUM_SCRIPT_ARGS; i++)
if (li->args[i] != spawnli->args[i]) if (li->args[i] != spawnli->args[i])
return false; return false;
@ -1606,7 +1606,7 @@ static boolean P_LineArgsEqual(const line_t *li, const line_t *spawnli)
static boolean P_LineStringArgsEqual(const line_t *li, const line_t *spawnli) static boolean P_LineStringArgsEqual(const line_t *li, const line_t *spawnli)
{ {
UINT8 i; UINT8 i;
for (i = 0; i < NUMLINESTRINGARGS; i++) for (i = 0; i < NUM_SCRIPT_STRINGARGS; i++)
{ {
if (!li->stringargs[i]) if (!li->stringargs[i])
return !spawnli->stringargs[i]; return !spawnli->stringargs[i];
@ -1869,12 +1869,12 @@ static void ArchiveSectors(savebuffer_t *save)
WRITEINT16(save->p, ss->action); WRITEINT16(save->p, ss->action);
if (diff4 & SD_ARGS) if (diff4 & SD_ARGS)
{ {
for (j = 0; j < NUMSECTORARGS; j++) for (j = 0; j < NUM_SCRIPT_ARGS; j++)
WRITEINT32(save->p, ss->args[j]); WRITEINT32(save->p, ss->args[j]);
} }
if (diff4 & SD_STRINGARGS) if (diff4 & SD_STRINGARGS)
{ {
for (j = 0; j < NUMSECTORSTRINGARGS; j++) for (j = 0; j < NUM_SCRIPT_STRINGARGS; j++)
{ {
size_t len, k; size_t len, k;
@ -2023,12 +2023,12 @@ static void UnArchiveSectors(savebuffer_t *save)
sectors[i].action = READINT16(save->p); sectors[i].action = READINT16(save->p);
if (diff4 & SD_ARGS) if (diff4 & SD_ARGS)
{ {
for (j = 0; j < NUMSECTORARGS; j++) for (j = 0; j < NUM_SCRIPT_ARGS; j++)
sectors[i].args[j] = READINT32(save->p); sectors[i].args[j] = READINT32(save->p);
} }
if (diff4 & SD_STRINGARGS) if (diff4 & SD_STRINGARGS)
{ {
for (j = 0; j < NUMLINESTRINGARGS; j++) for (j = 0; j < NUM_SCRIPT_STRINGARGS; j++)
{ {
size_t len = READINT32(save->p); size_t len = READINT32(save->p);
size_t k; size_t k;
@ -2159,13 +2159,13 @@ static void ArchiveLines(savebuffer_t *save)
if (diff2 & LD_ARGS) if (diff2 & LD_ARGS)
{ {
UINT8 j; UINT8 j;
for (j = 0; j < NUMLINEARGS; j++) for (j = 0; j < NUM_SCRIPT_ARGS; j++)
WRITEINT32(save->p, li->args[j]); WRITEINT32(save->p, li->args[j]);
} }
if (diff2 & LD_STRINGARGS) if (diff2 & LD_STRINGARGS)
{ {
UINT8 j; UINT8 j;
for (j = 0; j < NUMLINESTRINGARGS; j++) for (j = 0; j < NUM_SCRIPT_STRINGARGS; j++)
{ {
size_t len, k; size_t len, k;
@ -2248,13 +2248,13 @@ static void UnArchiveLines(savebuffer_t *save)
if (diff2 & LD_ARGS) if (diff2 & LD_ARGS)
{ {
UINT8 j; UINT8 j;
for (j = 0; j < NUMLINEARGS; j++) for (j = 0; j < NUM_SCRIPT_ARGS; j++)
li->args[j] = READINT32(save->p); li->args[j] = READINT32(save->p);
} }
if (diff2 & LD_STRINGARGS) if (diff2 & LD_STRINGARGS)
{ {
UINT8 j; UINT8 j;
for (j = 0; j < NUMLINESTRINGARGS; j++) for (j = 0; j < NUM_SCRIPT_STRINGARGS; j++)
{ {
size_t len = READINT32(save->p); size_t len = READINT32(save->p);
size_t k; size_t k;
@ -2320,8 +2320,8 @@ static void P_NetUnArchiveWorld(savebuffer_t *save)
static boolean P_ThingArgsEqual(const mobj_t *mobj, const mapthing_t *mapthing) static boolean P_ThingArgsEqual(const mobj_t *mobj, const mapthing_t *mapthing)
{ {
UINT8 i; UINT8 i;
for (i = 0; i < NUMMAPTHINGARGS; i++) for (i = 0; i < NUM_MAPTHING_ARGS; i++)
if (mobj->args[i] != mapthing->args[i]) if (mobj->thing_args[i] != mapthing->thing_args[i])
return false; return false;
return true; return true;
@ -2330,12 +2330,34 @@ static boolean P_ThingArgsEqual(const mobj_t *mobj, const mapthing_t *mapthing)
static boolean P_ThingStringArgsEqual(const mobj_t *mobj, const mapthing_t *mapthing) static boolean P_ThingStringArgsEqual(const mobj_t *mobj, const mapthing_t *mapthing)
{ {
UINT8 i; UINT8 i;
for (i = 0; i < NUMMAPTHINGSTRINGARGS; i++) for (i = 0; i < NUM_MAPTHING_STRINGARGS; i++)
{ {
if (!mobj->stringargs[i]) if (!mobj->thing_stringargs[i])
return !mapthing->stringargs[i]; return !mapthing->thing_stringargs[i];
if (strcmp(mobj->stringargs[i], mapthing->stringargs[i])) if (strcmp(mobj->thing_stringargs[i], mapthing->thing_stringargs[i]))
return false;
}
return true;
}
static boolean P_ThingScriptEqual(const mobj_t *mobj, const mapthing_t *mapthing)
{
UINT8 i;
if (mobj->special != mapthing->special)
return false;
for (i = 0; i < NUM_SCRIPT_ARGS; i++)
if (mobj->script_args[i] != mapthing->script_args[i])
return false;
for (i = 0; i < NUM_SCRIPT_STRINGARGS; i++)
{
if (!mobj->script_stringargs[i])
return !mapthing->script_stringargs[i];
if (strcmp(mobj->script_stringargs[i], mapthing->script_stringargs[i]))
return false; return false;
} }
@ -2548,7 +2570,7 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
if (!P_ThingStringArgsEqual(mobj, mobj->spawnpoint)) if (!P_ThingStringArgsEqual(mobj, mobj->spawnpoint))
diff |= MD_STRINGARGS; diff |= MD_STRINGARGS;
if (mobj->special != mobj->spawnpoint->type) if (!P_ThingScriptEqual(mobj, mobj->spawnpoint))
diff2 |= MD2_SPECIAL; diff2 |= MD2_SPECIAL;
} }
else else
@ -2556,18 +2578,18 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
// not a map spawned thing, so make it from scratch // not a map spawned thing, so make it from scratch
diff = MD_POS | MD_TYPE; diff = MD_POS | MD_TYPE;
for (j = 0; j < NUMMAPTHINGARGS; j++) for (j = 0; j < NUM_MAPTHING_ARGS; j++)
{ {
if (mobj->args[j] != 0) if (mobj->thing_args[j] != 0)
{ {
diff |= MD_ARGS; diff |= MD_ARGS;
break; break;
} }
} }
for (j = 0; j < NUMMAPTHINGSTRINGARGS; j++) for (j = 0; j < NUM_MAPTHING_STRINGARGS; j++)
{ {
if (mobj->stringargs[j] != NULL) if (mobj->thing_stringargs[j] != NULL)
{ {
diff |= MD_STRINGARGS; diff |= MD_STRINGARGS;
break; break;
@ -2578,6 +2600,24 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
{ {
diff2 |= MD2_SPECIAL; diff2 |= MD2_SPECIAL;
} }
for (j = 0; j < NUM_SCRIPT_ARGS; j++)
{
if (mobj->script_args[j] != 0)
{
diff2 |= MD2_SPECIAL;
break;
}
}
for (j = 0; j < NUM_SCRIPT_STRINGARGS; j++)
{
if (mobj->script_stringargs[j] != NULL)
{
diff2 |= MD2_SPECIAL;
break;
}
}
} }
// not the default but the most probable // not the default but the most probable
@ -2828,25 +2868,25 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
WRITEFIXED(save->p, mobj->scalespeed); WRITEFIXED(save->p, mobj->scalespeed);
if (diff & MD_ARGS) if (diff & MD_ARGS)
{ {
for (j = 0; j < NUMMAPTHINGARGS; j++) for (j = 0; j < NUM_MAPTHING_ARGS; j++)
WRITEINT32(save->p, mobj->args[j]); WRITEINT32(save->p, mobj->thing_args[j]);
} }
if (diff & MD_STRINGARGS) if (diff & MD_STRINGARGS)
{ {
for (j = 0; j < NUMMAPTHINGSTRINGARGS; j++) for (j = 0; j < NUM_MAPTHING_STRINGARGS; j++)
{ {
size_t len, k; size_t len, k;
if (!mobj->stringargs[j]) if (!mobj->thing_stringargs[j])
{ {
WRITEINT32(save->p, 0); WRITEINT32(save->p, 0);
continue; continue;
} }
len = strlen(mobj->stringargs[j]); len = strlen(mobj->thing_stringargs[j]);
WRITEINT32(save->p, len); WRITEINT32(save->p, len);
for (k = 0; k < len; k++) for (k = 0; k < len; k++)
WRITECHAR(save->p, mobj->stringargs[j][k]); WRITECHAR(save->p, mobj->thing_stringargs[j][k]);
} }
} }
if (diff2 & MD2_CUSVAL) if (diff2 & MD2_CUSVAL)
@ -2913,7 +2953,28 @@ static void SaveMobjThinker(savebuffer_t *save, const thinker_t *th, const UINT8
WRITEFIXED(save->p, mobj->sprzoff); WRITEFIXED(save->p, mobj->sprzoff);
} }
if (diff2 & MD2_SPECIAL) if (diff2 & MD2_SPECIAL)
{
WRITEINT16(save->p, mobj->special); WRITEINT16(save->p, mobj->special);
for (j = 0; j < NUM_SCRIPT_ARGS; j++)
WRITEINT32(save->p, mobj->script_args[j]);
for (j = 0; j < NUM_SCRIPT_STRINGARGS; j++)
{
size_t len, k;
if (!mobj->script_stringargs[j])
{
WRITEINT32(save->p, 0);
continue;
}
len = strlen(mobj->script_stringargs[j]);
WRITEINT32(save->p, len);
for (k = 0; k < len; k++)
WRITECHAR(save->p, mobj->script_stringargs[j][k]);
}
}
if (diff2 & MD2_FLOORSPRITESLOPE) if (diff2 & MD2_FLOORSPRITESLOPE)
{ {
pslope_t *slope = mobj->floorspriteslope; pslope_t *slope = mobj->floorspriteslope;
@ -4031,27 +4092,27 @@ static thinker_t* LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
mobj->scalespeed = mapobjectscale/12; mobj->scalespeed = mapobjectscale/12;
if (diff & MD_ARGS) if (diff & MD_ARGS)
{ {
for (j = 0; j < NUMMAPTHINGARGS; j++) for (j = 0; j < NUM_MAPTHING_ARGS; j++)
mobj->args[j] = READINT32(save->p); mobj->thing_args[j] = READINT32(save->p);
} }
if (diff & MD_STRINGARGS) if (diff & MD_STRINGARGS)
{ {
for (j = 0; j < NUMMAPTHINGSTRINGARGS; j++) for (j = 0; j < NUM_MAPTHING_STRINGARGS; j++)
{ {
size_t len = READINT32(save->p); size_t len = READINT32(save->p);
size_t k; size_t k;
if (!len) if (!len)
{ {
Z_Free(mobj->stringargs[j]); Z_Free(mobj->thing_stringargs[j]);
mobj->stringargs[j] = NULL; mobj->thing_stringargs[j] = NULL;
continue; continue;
} }
mobj->stringargs[j] = Z_Realloc(mobj->stringargs[j], len + 1, PU_LEVEL, NULL); mobj->thing_stringargs[j] = Z_Realloc(mobj->thing_stringargs[j], len + 1, PU_LEVEL, NULL);
for (k = 0; k < len; k++) for (k = 0; k < len; k++)
mobj->stringargs[j][k] = READCHAR(save->p); mobj->thing_stringargs[j][k] = READCHAR(save->p);
mobj->stringargs[j][len] = '\0'; mobj->thing_stringargs[j][len] = '\0';
} }
} }
if (diff2 & MD2_CUSVAL) if (diff2 & MD2_CUSVAL)
@ -4123,6 +4184,27 @@ static thinker_t* LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
if (diff2 & MD2_SPECIAL) if (diff2 & MD2_SPECIAL)
{ {
mobj->special = READINT16(save->p); mobj->special = READINT16(save->p);
for (j = 0; j < NUM_SCRIPT_ARGS; j++)
mobj->script_args[j] = READINT32(save->p);
for (j = 0; j < NUM_SCRIPT_STRINGARGS; j++)
{
size_t len = READINT32(save->p);
size_t k;
if (!len)
{
Z_Free(mobj->script_stringargs[j]);
mobj->script_stringargs[j] = NULL;
continue;
}
mobj->script_stringargs[j] = Z_Realloc(mobj->script_stringargs[j], len + 1, PU_LEVEL, NULL);
for (k = 0; k < len; k++)
mobj->script_stringargs[j][k] = READCHAR(save->p);
mobj->script_stringargs[j][len] = '\0';
}
} }
if (diff2 & MD2_FLOORSPRITESLOPE) if (diff2 & MD2_FLOORSPRITESLOPE)
{ {

File diff suppressed because it is too large Load diff

View file

@ -640,7 +640,7 @@ static pslope_t *MakeViaMapthings(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
vx[i].x = mt->x << FRACBITS; vx[i].x = mt->x << FRACBITS;
vx[i].y = mt->y << FRACBITS; vx[i].y = mt->y << FRACBITS;
vx[i].z = mt->z << FRACBITS; vx[i].z = mt->z << FRACBITS;
if (!mt->args[0]) if (!mt->thing_args[0])
vx[i].z += R_PointInSubsector(vx[i].x, vx[i].y)->sector->floorheight; vx[i].z += R_PointInSubsector(vx[i].x, vx[i].y)->sector->floorheight;
} }

View file

@ -2380,7 +2380,7 @@ void P_ActivateThingSpecial(mobj_t *mo, mobj_t *source)
activator->sector = source->subsector->sector; activator->sector = source->subsector->sector;
} }
P_ProcessSpecial(activator, mo->special, mo->args, mo->stringargs); P_ProcessSpecial(activator, mo->special, mo->script_args, mo->script_stringargs);
P_SetTarget(&activator->mo, NULL); P_SetTarget(&activator->mo, NULL);
Z_Free(activator); Z_Free(activator);
@ -4281,7 +4281,7 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
if (backwardsCompat) if (backwardsCompat)
break; break;
if (args[1] < 0 || args[1] >= NUMLINEARGS) if (args[1] < 0 || args[1] >= NUM_SCRIPT_ARGS)
{ {
CONS_Debug(DBG_GAMELOGIC, "Linedef type 468: Invalid linedef arg %d\n", args[1]); CONS_Debug(DBG_GAMELOGIC, "Linedef type 468: Invalid linedef arg %d\n", args[1]);
break; break;
@ -4326,7 +4326,7 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
case 475: // ACS_Execute case 475: // ACS_Execute
{ {
INT32 newArgs[NUMLINEARGS-1] = {0}; INT32 newArgs[NUM_SCRIPT_ARGS-1] = {0};
INT32 i; INT32 i;
if (!stringargs[0]) if (!stringargs[0])
@ -4335,17 +4335,17 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
return false; return false;
} }
for (i = 1; i < NUMLINEARGS; i++) for (i = 1; i < NUM_SCRIPT_ARGS; i++)
{ {
newArgs[i - 1] = args[i]; newArgs[i - 1] = args[i];
} }
ACS_Execute(stringargs[0], newArgs, NUMLINEARGS-1, activator); ACS_Execute(stringargs[0], newArgs, NUM_SCRIPT_ARGS-1, activator);
} }
break; break;
case 476: // ACS_ExecuteAlways case 476: // ACS_ExecuteAlways
{ {
INT32 newArgs[NUMLINEARGS-1] = {0}; INT32 newArgs[NUM_SCRIPT_ARGS-1] = {0};
INT32 i; INT32 i;
if (!stringargs[0]) if (!stringargs[0])
@ -4354,12 +4354,12 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
return false; return false;
} }
for (i = 1; i < NUMLINEARGS; i++) for (i = 1; i < NUM_SCRIPT_ARGS; i++)
{ {
newArgs[i - 1] = args[i]; newArgs[i - 1] = args[i];
} }
ACS_ExecuteAlways(stringargs[0], newArgs, NUMLINEARGS-1, activator); ACS_ExecuteAlways(stringargs[0], newArgs, NUM_SCRIPT_ARGS-1, activator);
} }
break; break;
case 477: // ACS_Suspend case 477: // ACS_Suspend

View file

@ -445,9 +445,6 @@ typedef enum
CRUMBLE_RESTORE, // Crumble thinker is about to restore to original position CRUMBLE_RESTORE, // Crumble thinker is about to restore to original position
} crumblestate_t; } crumblestate_t;
#define NUMSECTORARGS 10
#define NUMSECTORSTRINGARGS 2
// //
// The SECTORS record, at runtime. // The SECTORS record, at runtime.
// Stores things/mobjs. // Stores things/mobjs.
@ -554,8 +551,8 @@ struct sector_t
// Action specials // Action specials
INT16 action; INT16 action;
INT32 args[NUMSECTORARGS]; INT32 args[NUM_SCRIPT_ARGS];
char *stringargs[NUMSECTORSTRINGARGS]; char *stringargs[NUM_SCRIPT_STRINGARGS];
sectoractionflags_t activation; sectoractionflags_t activation;
// UDMF user-defined custom properties. // UDMF user-defined custom properties.
@ -573,10 +570,7 @@ typedef enum
ST_NEGATIVE ST_NEGATIVE
} slopetype_t; } slopetype_t;
#define HORIZONSPECIAL 41 #define HORIZONSPECIAL (41)
#define NUMLINEARGS 10
#define NUMLINESTRINGARGS 2
struct line_t struct line_t
{ {
@ -592,8 +586,8 @@ struct line_t
UINT32 activation; UINT32 activation;
INT16 special; INT16 special;
taglist_t tags; taglist_t tags;
INT32 args[NUMLINEARGS]; INT32 args[NUM_SCRIPT_ARGS];
char *stringargs[NUMLINESTRINGARGS]; char *stringargs[NUM_SCRIPT_STRINGARGS];
// Visual appearance: sidedefs. // Visual appearance: sidedefs.
UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided

View file

@ -67,6 +67,7 @@ extern size_t numspritelumps, max_spritelumps;
// //
// Lookup tables for map data. // Lookup tables for map data.
// //
#define UDMF_CURRENT_VERSION (1)
extern boolean udmf; extern boolean udmf;
extern size_t numsprites; extern size_t numsprites;

View file

@ -199,7 +199,7 @@ get_anchor
for (i = 0; i < list->count; ++i) for (i = 0; i < list->count; ++i)
{ {
if (list->points[i] == v && list->anchors[i]->args[0] == group) if (list->points[i] == v && list->anchors[i]->thing_args[0] == group)
{ {
for (k = 0; k < 3; ++k) for (k = 0; k < 3; ++k)
{ {