Skip to content

Commit

Permalink
Hexen: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jan 26, 2014
1 parent ad29593 commit 9a8242f
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 154 deletions.
4 changes: 2 additions & 2 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -2183,7 +2183,7 @@ static void G_InitNewGame(void)
SV_ClearSlot(AUTO_SLOT);

#if __JHEXEN__
P_ACSInitNewGame();
P_InitACScript();
#endif
}

Expand Down Expand Up @@ -2729,7 +2729,7 @@ void G_DoLeaveMap(void)
// Launch waiting scripts.
if(!deathmatch)
{
P_CheckACSStore(gameMap);
P_CheckACScriptStore(gameMap);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/p_ceiling.c
Expand Up @@ -93,7 +93,7 @@ static void stopCeiling(ceiling_t* ceiling)
{
P_ToXSector(ceiling->sector)->specialData = NULL;
#if __JHEXEN__
P_TagFinished(P_ToXSector(ceiling->sector)->tag);
P_ACScriptTagFinished(P_ToXSector(ceiling->sector)->tag);
#endif
Thinker_Remove(&ceiling->thinker);
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/src/p_door.c
Expand Up @@ -219,7 +219,7 @@ void T_Door(void *doorThinkerPtr)
case DT_CLOSE:
xsec->specialData = NULL;
#if __JHEXEN__
P_TagFinished(P_ToXSector(door->sector)->tag);
P_ACScriptTagFinished(P_ToXSector(door->sector)->tag);
#endif
Thinker_Remove(&door->thinker); // Unlink and free.
#if __JHERETIC__
Expand Down Expand Up @@ -300,7 +300,7 @@ void T_Door(void *doorThinkerPtr)
case DT_OPEN:
xsec->specialData = NULL;
#if __JHEXEN__
P_TagFinished(P_ToXSector(door->sector)->tag);
P_ACScriptTagFinished(P_ToXSector(door->sector)->tag);
#endif
Thinker_Remove(&door->thinker); // Unlink and free.
#if __JHERETIC__
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/src/p_floor.c
Expand Up @@ -424,7 +424,7 @@ void T_MoveFloor(void *floorThinkerPtr)
}
#endif
#if __JHEXEN__
P_TagFinished(P_ToXSector(floor->sector)->tag);
P_ACScriptTagFinished(P_ToXSector(floor->sector)->tag);
#endif
Thinker_Remove(&floor->thinker);
}
Expand Down Expand Up @@ -1411,7 +1411,7 @@ static int stopFloorCrush(thinker_t* th, void* context)
// Completely remove the crushing floor
SN_StopSequence(P_GetPtrp(floor->sector, DMU_EMITTER));
P_ToXSector(floor->sector)->specialData = NULL;
P_TagFinished(P_ToXSector(floor->sector)->tag);
P_ACScriptTagFinished(P_ToXSector(floor->sector)->tag);
Thinker_Remove(&floor->thinker);
(*found) = true;
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/src/p_map.cpp
Expand Up @@ -3195,7 +3195,7 @@ static int PTR_PuzzleItemTraverse(Intercept const *icpt, void *context)
return true; // Item type doesn't match.
}

P_StartACS(xline->arg2, 0, &xline->arg3, parm.useMobj, icpt->line, 0);
P_StartACScript(xline->arg2, 0, &xline->arg3, parm.useMobj, icpt->line, 0);
xline->special = 0;

parm.activated = true;
Expand All @@ -3214,7 +3214,7 @@ static int PTR_PuzzleItemTraverse(Intercept const *icpt, void *context)
return false; // Item type doesn't match...
}

P_StartACS(icpt->mobj->args[1], 0, &icpt->mobj->args[2], parm.useMobj, NULL, 0);
P_StartACScript(icpt->mobj->args[1], 0, &icpt->mobj->args[2], parm.useMobj, NULL, 0);
icpt->mobj->special = 0;

parm.activated = true;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/p_plat.c
Expand Up @@ -96,7 +96,7 @@ static void stopPlat(plat_t* plat)
{
P_ToXSector(plat->sector)->specialData = NULL;
#if __JHEXEN__
P_TagFinished(P_ToXSector(plat->sector)->tag);
P_ACScriptTagFinished(P_ToXSector(plat->sector)->tag);
#endif
Thinker_Remove(&plat->thinker);
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/polyobjs.cpp
Expand Up @@ -57,7 +57,7 @@ static int findMirrorPolyobj(int tag)
static void notifyPolyobjFinished(int tag)
{
#if __JHEXEN__
P_ACSPolyobjFinished(tag);
P_ACScriptPolyobjFinished(tag);
#else
DENG_UNUSED(tag);
#endif
Expand Down
31 changes: 16 additions & 15 deletions doomsday/plugins/hexen/include/acscript.h
Expand Up @@ -38,30 +38,31 @@
extern "C" {
#endif

/**
* To be called when a new game session begins to initialize ACS scripting.
*/
void P_InitACScript(void);

void P_LoadACScripts(int lump);

/**
* @param map Map number on which the script is being started on.
* @c 0 = Current map. Otherwise 1-based index of the map to start on (deferred).
*/
dd_bool P_StartACS(int number, uint map, byte *args, mobj_t *activator, Line *line, int side);

dd_bool P_StartLockedACS(Line *line, byte *args, mobj_t *mo, int side);

dd_bool P_TerminateACS(int number, uint map);
dd_bool P_StartACScript(int number, uint map, byte *args, mobj_t *activator, Line *line, int side);

dd_bool P_SuspendACS(int number, uint map);
dd_bool P_TerminateACScript(int number, uint map);

void P_TagFinished(int tag);
dd_bool P_SuspendACScript(int number, uint map);

void P_ACSPolyobjFinished(int tag);
void P_ACScriptTagFinished(int tag);

void P_ACSInitNewGame(void);
void P_ACScriptPolyobjFinished(int tag);

/**
* Scans the ACS store and executes all scripts belonging to the current map.
*/
void P_CheckACSStore(uint map);
void P_CheckACScriptStore(uint map);

void P_WriteGlobalACScriptData(void);
void P_ReadGlobalACScriptData(int saveVersion);
Expand All @@ -76,7 +77,7 @@ void P_ReadMapACScriptData(void);
/**
* Action script thinker.
*/
typedef struct acs_s {
typedef struct acscript_s {
thinker_t thinker;
mobj_t *activator;
Line *line;
Expand All @@ -88,23 +89,23 @@ typedef struct acs_s {
int stackPtr;
int vars[MAX_ACS_SCRIPT_VARS];
int const *ip;
} acs_t;
} ACScript;

#ifdef __cplusplus
extern "C" {
#endif

void ACScript_Thinker(acs_t *script);
void ACScript_Thinker(ACScript *script);

/**
* Serialize the thinker to the currently open save file.
*/
void ACScript_Write(acs_t const *script);
void ACScript_Write(ACScript const *script);

/**
* Deserialize the thinker from the currently open save file.
*/
int ACScript_Read(acs_t *script, int mapVersion);
int ACScript_Read(ACScript *script, int mapVersion);

#ifdef __cplusplus
} // extern "C"
Expand Down

0 comments on commit 9a8242f

Please sign in to comment.