1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783 |
- //**************************************************************************
- //**
- //** p_acs.c : Heretic 2 : Raven Software, Corp.
- //**
- //** $RCSfile: p_acs.c,v $
- //** $Revision: 1.31 $
- //** $Date: 95/10/09 16:25:17 $
- //** $Author: cjr $
- //**
- //**************************************************************************
- // HEADER FILES ------------------------------------------------------------
- #include "h2def.h"
- #include "p_local.h"
- // MACROS ------------------------------------------------------------------
- #define SCRIPT_CONTINUE 0
- #define SCRIPT_STOP 1
- #define SCRIPT_TERMINATE 2
- #define OPEN_SCRIPTS_BASE 1000
- #define PRINT_BUFFER_SIZE 256
- #define GAME_SINGLE_PLAYER 0
- #define GAME_NET_COOPERATIVE 1
- #define GAME_NET_DEATHMATCH 2
- #define TEXTURE_TOP 0
- #define TEXTURE_MIDDLE 1
- #define TEXTURE_BOTTOM 2
- #define S_DROP ACScript->stackPtr--
- #define S_POP ACScript->stack[--ACScript->stackPtr]
- #define S_PUSH(x) ACScript->stack[ACScript->stackPtr++] = x
- // TYPES -------------------------------------------------------------------
- typedef struct
- {
- int marker;
- int infoOffset;
- int code;
- } acsHeader_t;
- // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
- // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
- // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
- static void StartOpenACS(int number, int infoIndex, int *address);
- static void ScriptFinished(int number);
- static boolean TagBusy(int tag);
- static boolean AddToACSStore(int map, int number, byte *args);
- static int GetACSIndex(int number);
- static void Push(int value);
- static int Pop(void);
- static int Top(void);
- static void Drop(void);
- static int CmdNOP(void);
- static int CmdTerminate(void);
- static int CmdSuspend(void);
- static int CmdPushNumber(void);
- static int CmdLSpec1(void);
- static int CmdLSpec2(void);
- static int CmdLSpec3(void);
- static int CmdLSpec4(void);
- static int CmdLSpec5(void);
- static int CmdLSpec1Direct(void);
- static int CmdLSpec2Direct(void);
- static int CmdLSpec3Direct(void);
- static int CmdLSpec4Direct(void);
- static int CmdLSpec5Direct(void);
- static int CmdAdd(void);
- static int CmdSubtract(void);
- static int CmdMultiply(void);
- static int CmdDivide(void);
- static int CmdModulus(void);
- static int CmdEQ(void);
- static int CmdNE(void);
- static int CmdLT(void);
- static int CmdGT(void);
- static int CmdLE(void);
- static int CmdGE(void);
- static int CmdAssignScriptVar(void);
- static int CmdAssignMapVar(void);
- static int CmdAssignWorldVar(void);
- static int CmdPushScriptVar(void);
- static int CmdPushMapVar(void);
- static int CmdPushWorldVar(void);
- static int CmdAddScriptVar(void);
- static int CmdAddMapVar(void);
- static int CmdAddWorldVar(void);
- static int CmdSubScriptVar(void);
- static int CmdSubMapVar(void);
- static int CmdSubWorldVar(void);
- static int CmdMulScriptVar(void);
- static int CmdMulMapVar(void);
- static int CmdMulWorldVar(void);
- static int CmdDivScriptVar(void);
- static int CmdDivMapVar(void);
- static int CmdDivWorldVar(void);
- static int CmdModScriptVar(void);
- static int CmdModMapVar(void);
- static int CmdModWorldVar(void);
- static int CmdIncScriptVar(void);
- static int CmdIncMapVar(void);
- static int CmdIncWorldVar(void);
- static int CmdDecScriptVar(void);
- static int CmdDecMapVar(void);
- static int CmdDecWorldVar(void);
- static int CmdGoto(void);
- static int CmdIfGoto(void);
- static int CmdDrop(void);
- static int CmdDelay(void);
- static int CmdDelayDirect(void);
- static int CmdRandom(void);
- static int CmdRandomDirect(void);
- static int CmdThingCount(void);
- static int CmdThingCountDirect(void);
- static int CmdTagWait(void);
- static int CmdTagWaitDirect(void);
- static int CmdPolyWait(void);
- static int CmdPolyWaitDirect(void);
- static int CmdChangeFloor(void);
- static int CmdChangeFloorDirect(void);
- static int CmdChangeCeiling(void);
- static int CmdChangeCeilingDirect(void);
- static int CmdRestart(void);
- static int CmdAndLogical(void);
- static int CmdOrLogical(void);
- static int CmdAndBitwise(void);
- static int CmdOrBitwise(void);
- static int CmdEorBitwise(void);
- static int CmdNegateLogical(void);
- static int CmdLShift(void);
- static int CmdRShift(void);
- static int CmdUnaryMinus(void);
- static int CmdIfNotGoto(void);
- static int CmdLineSide(void);
- static int CmdScriptWait(void);
- static int CmdScriptWaitDirect(void);
- static int CmdClearLineSpecial(void);
- static int CmdCaseGoto(void);
- static int CmdBeginPrint(void);
- static int CmdEndPrint(void);
- static int CmdPrintString(void);
- static int CmdPrintNumber(void);
- static int CmdPrintCharacter(void);
- static int CmdPlayerCount(void);
- static int CmdGameType(void);
- static int CmdGameSkill(void);
- static int CmdTimer(void);
- static int CmdSectorSound(void);
- static int CmdAmbientSound(void);
- static int CmdSoundSequence(void);
- static int CmdSetLineTexture(void);
- static int CmdSetLineBlocking(void);
- static int CmdSetLineSpecial(void);
- static int CmdThingSound(void);
- static int CmdEndPrintBold(void);
- static void ThingCount(int type, int tid);
- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
- // PUBLIC DATA DEFINITIONS -------------------------------------------------
- int ACScriptCount;
- byte *ActionCodeBase;
- acsInfo_t *ACSInfo;
- int MapVars[MAX_ACS_MAP_VARS];
- int WorldVars[MAX_ACS_WORLD_VARS];
- acsstore_t ACSStore[MAX_ACS_STORE+1]; // +1 for termination marker
- // PRIVATE DATA DEFINITIONS ------------------------------------------------
- static acs_t *ACScript;
- static int *PCodePtr;
- static byte SpecArgs[8];
- static int ACStringCount;
- static char **ACStrings;
- static char PrintBuffer[PRINT_BUFFER_SIZE];
- static acs_t *NewScript;
- static int (*PCodeCmds[])(void) =
- {
- CmdNOP,
- CmdTerminate,
- CmdSuspend,
- CmdPushNumber,
- CmdLSpec1,
- CmdLSpec2,
- CmdLSpec3,
- CmdLSpec4,
- CmdLSpec5,
- CmdLSpec1Direct,
- CmdLSpec2Direct,
- CmdLSpec3Direct,
- CmdLSpec4Direct,
- CmdLSpec5Direct,
- CmdAdd,
- CmdSubtract,
- CmdMultiply,
- CmdDivide,
- CmdModulus,
- CmdEQ,
- CmdNE,
- CmdLT,
- CmdGT,
- CmdLE,
- CmdGE,
- CmdAssignScriptVar,
- CmdAssignMapVar,
- CmdAssignWorldVar,
- CmdPushScriptVar,
- CmdPushMapVar,
- CmdPushWorldVar,
- CmdAddScriptVar,
- CmdAddMapVar,
- CmdAddWorldVar,
- CmdSubScriptVar,
- CmdSubMapVar,
- CmdSubWorldVar,
- CmdMulScriptVar,
- CmdMulMapVar,
- CmdMulWorldVar,
- CmdDivScriptVar,
- CmdDivMapVar,
- CmdDivWorldVar,
- CmdModScriptVar,
- CmdModMapVar,
- CmdModWorldVar,
- CmdIncScriptVar,
- CmdIncMapVar,
- CmdIncWorldVar,
- CmdDecScriptVar,
- CmdDecMapVar,
- CmdDecWorldVar,
- CmdGoto,
- CmdIfGoto,
- CmdDrop,
- CmdDelay,
- CmdDelayDirect,
- CmdRandom,
- CmdRandomDirect,
- CmdThingCount,
- CmdThingCountDirect,
- CmdTagWait,
- CmdTagWaitDirect,
- CmdPolyWait,
- CmdPolyWaitDirect,
- CmdChangeFloor,
- CmdChangeFloorDirect,
- CmdChangeCeiling,
- CmdChangeCeilingDirect,
- CmdRestart,
- CmdAndLogical,
- CmdOrLogical,
- CmdAndBitwise,
- CmdOrBitwise,
- CmdEorBitwise,
- CmdNegateLogical,
- CmdLShift,
- CmdRShift,
- CmdUnaryMinus,
- CmdIfNotGoto,
- CmdLineSide,
- CmdScriptWait,
- CmdScriptWaitDirect,
- CmdClearLineSpecial,
- CmdCaseGoto,
- CmdBeginPrint,
- CmdEndPrint,
- CmdPrintString,
- CmdPrintNumber,
- CmdPrintCharacter,
- CmdPlayerCount,
- CmdGameType,
- CmdGameSkill,
- CmdTimer,
- CmdSectorSound,
- CmdAmbientSound,
- CmdSoundSequence,
- CmdSetLineTexture,
- CmdSetLineBlocking,
- CmdSetLineSpecial,
- CmdThingSound,
- CmdEndPrintBold
- };
- // CODE --------------------------------------------------------------------
- //==========================================================================
- //
- // P_LoadACScripts
- //
- //==========================================================================
- void P_LoadACScripts(int lump)
- {
- int i;
- int *buffer;
- acsHeader_t *header;
- acsInfo_t *info;
- header = W_CacheLumpNum(lump, PU_LEVEL);
- ActionCodeBase = (byte *)header;
- buffer = (int *)((byte *)header+header->infoOffset);
- ACScriptCount = *buffer++;
- if(ACScriptCount == 0)
- { // Empty behavior lump
- return;
- }
- ACSInfo = Z_Malloc(ACScriptCount*sizeof(acsInfo_t), PU_LEVEL, 0);
- memset(ACSInfo, 0, ACScriptCount*sizeof(acsInfo_t));
- for(i = 0, info = ACSInfo; i < ACScriptCount; i++, info++)
- {
- info->number = *buffer++;
- info->address = (int *)((byte *)ActionCodeBase+*buffer++);
- info->argCount = *buffer++;
- if(info->number >= OPEN_SCRIPTS_BASE)
- { // Auto-activate
- info->number -= OPEN_SCRIPTS_BASE;
- StartOpenACS(info->number, i, info->address);
- info->state = ASTE_RUNNING;
- }
- else
- {
- info->state = ASTE_INACTIVE;
- }
- }
- ACStringCount = *buffer++;
- ACStrings = (char **)buffer;
- for(i = 0; i < ACStringCount; i++)
- {
- ACStrings[i] += (int)ActionCodeBase;
- }
- memset(MapVars, 0, sizeof(MapVars));
- }
- //==========================================================================
- //
- // StartOpenACS
- //
- //==========================================================================
- static void StartOpenACS(int number, int infoIndex, int *address)
- {
- acs_t *script;
- script = Z_Malloc(sizeof(acs_t), PU_LEVSPEC, 0);
- memset(script, 0, sizeof(acs_t));
- script->number = number;
- // World objects are allotted 1 second for initialization
- script->delayCount = 35;
- script->infoIndex = infoIndex;
- script->ip = address;
- script->thinker.function = T_InterpretACS;
- P_AddThinker(&script->thinker);
- }
- //==========================================================================
- //
- // P_CheckACSStore
- //
- // Scans the ACS store and executes all scripts belonging to the current
- // map.
- //
- //==========================================================================
- void P_CheckACSStore(void)
- {
- acsstore_t *store;
- for(store = ACSStore; store->map != 0; store++)
- {
- if(store->map == gamemap)
- {
- P_StartACS(store->script, 0, store->args, NULL, NULL, 0);
- if(NewScript)
- {
- NewScript->delayCount = 35;
- }
- store->map = -1;
- }
- }
- }
- //==========================================================================
- //
- // P_StartACS
- //
- //==========================================================================
- static char ErrorMsg[128];
- boolean P_StartACS(int number, int map, byte *args, mobj_t *activator,
- line_t *line, int side)
- {
- int i;
- acs_t *script;
- int infoIndex;
- aste_t *statePtr;
- NewScript = NULL;
- if(map && map != gamemap)
- { // Add to the script store
- return AddToACSStore(map, number, args);
- }
- infoIndex = GetACSIndex(number);
- if(infoIndex == -1)
- { // Script not found
- //I_Error("P_StartACS: Unknown script number %d", number);
- sprintf(ErrorMsg, "P_STARTACS ERROR: UNKNOWN SCRIPT %d", number);
- P_SetMessage(&players[consoleplayer], ErrorMsg, true);
- }
- statePtr = &ACSInfo[infoIndex].state;
- if(*statePtr == ASTE_SUSPENDED)
- { // Resume a suspended script
- *statePtr = ASTE_RUNNING;
- return true;
- }
- if(*statePtr != ASTE_INACTIVE)
- { // Script is already executing
- return false;
- }
- script = Z_Malloc(sizeof(acs_t), PU_LEVSPEC, 0);
- memset(script, 0, sizeof(acs_t));
- script->number = number;
- script->infoIndex = infoIndex;
- script->activator = activator;
- script->line = line;
- script->side = side;
- script->ip = ACSInfo[infoIndex].address;
- script->thinker.function = T_InterpretACS;
- for(i = 0; i < ACSInfo[infoIndex].argCount; i++)
- {
- script->vars[i] = args[i];
- }
- *statePtr = ASTE_RUNNING;
- P_AddThinker(&script->thinker);
- NewScript = script;
- return true;
- }
- //==========================================================================
- //
- // AddToACSStore
- //
- //==========================================================================
- static boolean AddToACSStore(int map, int number, byte *args)
- {
- int i;
- int index;
- index = -1;
- for(i = 0; ACSStore[i].map != 0; i++)
- {
- if(ACSStore[i].script == number
- && ACSStore[i].map == map)
- { // Don't allow duplicates
- return false;
- }
- if(index == -1 && ACSStore[i].map == -1)
- { // Remember first empty slot
- index = i;
- }
- }
- if(index == -1)
- { // Append required
- if(i == MAX_ACS_STORE)
- {
- I_Error("AddToACSStore: MAX_ACS_STORE (%d) exceeded.",
- MAX_ACS_STORE);
- }
- index = i;
- ACSStore[index+1].map = 0;
- }
- ACSStore[index].map = map;
- ACSStore[index].script = number;
- *((int *)ACSStore[index].args) = *((int *)args);
- return true;
- }
- //==========================================================================
- //
- // P_StartLockedACS
- //
- //==========================================================================
- boolean P_StartLockedACS(line_t *line, byte *args, mobj_t *mo, int side)
- {
- int i;
- int lock;
- byte newArgs[5];
- char LockedBuffer[80];
- extern char *TextKeyMessages[11];
- lock = args[4];
- if(!mo->player)
- {
- return false;
- }
- if(lock)
- {
- if(!(mo->player->keys&(1<<(lock-1))))
- {
- sprintf(LockedBuffer, "YOU NEED THE %s\n",
- TextKeyMessages[lock-1]);
- P_SetMessage(mo->player, LockedBuffer, true);
- S_StartSound(mo, SFX_DOOR_LOCKED);
- return false;
- }
- }
- for(i = 0; i < 4; i++)
- {
- newArgs[i] = args[i];
- }
- newArgs[4] = 0;
- return P_StartACS(newArgs[0], newArgs[1], &newArgs[2], mo,
- line, side);
- }
- //==========================================================================
- //
- // P_TerminateACS
- //
- //==========================================================================
- boolean P_TerminateACS(int number, int map)
- {
- int infoIndex;
- infoIndex = GetACSIndex(number);
- if(infoIndex == -1)
- { // Script not found
- return false;
- }
- if(ACSInfo[infoIndex].state == ASTE_INACTIVE
- || ACSInfo[infoIndex].state == ASTE_TERMINATING)
- { // States that disallow termination
- return false;
- }
- ACSInfo[infoIndex].state = ASTE_TERMINATING;
- return true;
- }
- //==========================================================================
- //
- // P_SuspendACS
- //
- //==========================================================================
- boolean P_SuspendACS(int number, int map)
- {
- int infoIndex;
- infoIndex = GetACSIndex(number);
- if(infoIndex == -1)
- { // Script not found
- return false;
- }
- if(ACSInfo[infoIndex].state == ASTE_INACTIVE
- || ACSInfo[infoIndex].state == ASTE_SUSPENDED
- || ACSInfo[infoIndex].state == ASTE_TERMINATING)
- { // States that disallow suspension
- return false;
- }
- ACSInfo[infoIndex].state = ASTE_SUSPENDED;
- return true;
- }
- //==========================================================================
- //
- // P_Init
- //
- //==========================================================================
- void P_ACSInitNewGame(void)
- {
- memset(WorldVars, 0, sizeof(WorldVars));
- memset(ACSStore, 0, sizeof(ACSStore));
- }
- //==========================================================================
- //
- // T_InterpretACS
- //
- //==========================================================================
- void T_InterpretACS(acs_t *script)
- {
- int cmd;
- int action;
- if(ACSInfo[script->infoIndex].state == ASTE_TERMINATING)
- {
- ACSInfo[script->infoIndex].state = ASTE_INACTIVE;
- ScriptFinished(ACScript->number);
- P_RemoveThinker(&ACScript->thinker);
- return;
- }
- if(ACSInfo[script->infoIndex].state != ASTE_RUNNING)
- {
- return;
- }
- if(script->delayCount)
- {
- script->delayCount--;
- return;
- }
- ACScript = script;
- PCodePtr = ACScript->ip;
- do
- {
- cmd = *PCodePtr++;
- action = PCodeCmds[cmd]();
- } while(action == SCRIPT_CONTINUE);
- ACScript->ip = PCodePtr;
- if(action == SCRIPT_TERMINATE)
- {
- ACSInfo[script->infoIndex].state = ASTE_INACTIVE;
- ScriptFinished(ACScript->number);
- P_RemoveThinker(&ACScript->thinker);
- }
- }
- //==========================================================================
- //
- // P_TagFinished
- //
- //==========================================================================
- void P_TagFinished(int tag)
- {
- int i;
- if(TagBusy(tag) == true)
- {
- return;
- }
- for(i = 0; i < ACScriptCount; i++)
- {
- if(ACSInfo[i].state == ASTE_WAITINGFORTAG
- && ACSInfo[i].waitValue == tag)
- {
- ACSInfo[i].state = ASTE_RUNNING;
- }
- }
- }
- //==========================================================================
- //
- // P_PolyobjFinished
- //
- //==========================================================================
- void P_PolyobjFinished(int po)
- {
- int i;
- if(PO_Busy(po) == true)
- {
- return;
- }
- for(i = 0; i < ACScriptCount; i++)
- {
- if(ACSInfo[i].state == ASTE_WAITINGFORPOLY
- && ACSInfo[i].waitValue == po)
- {
- ACSInfo[i].state = ASTE_RUNNING;
- }
- }
- }
- //==========================================================================
- //
- // ScriptFinished
- //
- //==========================================================================
- static void ScriptFinished(int number)
- {
- int i;
- for(i = 0; i < ACScriptCount; i++)
- {
- if(ACSInfo[i].state == ASTE_WAITINGFORSCRIPT
- && ACSInfo[i].waitValue == number)
- {
- ACSInfo[i].state = ASTE_RUNNING;
- }
- }
- }
- //==========================================================================
- //
- // TagBusy
- //
- //==========================================================================
- static boolean TagBusy(int tag)
- {
- int sectorIndex;
- sectorIndex = -1;
- while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0)
- {
- if(sectors[sectorIndex].specialdata)
- {
- return true;
- }
- }
- return false;
- }
- //==========================================================================
- //
- // GetACSIndex
- //
- // Returns the index of a script number. Returns -1 if the script number
- // is not found.
- //
- //==========================================================================
- static int GetACSIndex(int number)
- {
- int i;
- for(i = 0; i < ACScriptCount; i++)
- {
- if(ACSInfo[i].number == number)
- {
- return i;
- }
- }
- return -1;
- }
- //==========================================================================
- //
- // Push
- //
- //==========================================================================
- static void Push(int value)
- {
- ACScript->stack[ACScript->stackPtr++] = value;
- }
- //==========================================================================
- //
- // Pop
- //
- //==========================================================================
- static int Pop(void)
- {
- return ACScript->stack[--ACScript->stackPtr];
- }
- //==========================================================================
- //
- // Top
- //
- //==========================================================================
- static int Top(void)
- {
- return ACScript->stack[ACScript->stackPtr-1];
- }
- //==========================================================================
- //
- // Drop
- //
- //==========================================================================
- static void Drop(void)
- {
- ACScript->stackPtr--;
- }
- //==========================================================================
- //
- // P-Code Commands
- //
- //==========================================================================
- static int CmdNOP(void)
- {
- return SCRIPT_CONTINUE;
- }
- static int CmdTerminate(void)
- {
- return SCRIPT_TERMINATE;
- }
- static int CmdSuspend(void)
- {
- ACSInfo[ACScript->infoIndex].state = ASTE_SUSPENDED;
- return SCRIPT_STOP;
- }
- static int CmdPushNumber(void)
- {
- Push(*PCodePtr++);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec1(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[0] = Pop();
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec2(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[1] = Pop();
- SpecArgs[0] = Pop();
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec3(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[2] = Pop();
- SpecArgs[1] = Pop();
- SpecArgs[0] = Pop();
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec4(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[3] = Pop();
- SpecArgs[2] = Pop();
- SpecArgs[1] = Pop();
- SpecArgs[0] = Pop();
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec5(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[4] = Pop();
- SpecArgs[3] = Pop();
- SpecArgs[2] = Pop();
- SpecArgs[1] = Pop();
- SpecArgs[0] = Pop();
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec1Direct(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[0] = *PCodePtr++;
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec2Direct(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[0] = *PCodePtr++;
- SpecArgs[1] = *PCodePtr++;
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec3Direct(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[0] = *PCodePtr++;
- SpecArgs[1] = *PCodePtr++;
- SpecArgs[2] = *PCodePtr++;
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec4Direct(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[0] = *PCodePtr++;
- SpecArgs[1] = *PCodePtr++;
- SpecArgs[2] = *PCodePtr++;
- SpecArgs[3] = *PCodePtr++;
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdLSpec5Direct(void)
- {
- int special;
- special = *PCodePtr++;
- SpecArgs[0] = *PCodePtr++;
- SpecArgs[1] = *PCodePtr++;
- SpecArgs[2] = *PCodePtr++;
- SpecArgs[3] = *PCodePtr++;
- SpecArgs[4] = *PCodePtr++;
- P_ExecuteLineSpecial(special, SpecArgs, ACScript->line,
- ACScript->side, ACScript->activator);
- return SCRIPT_CONTINUE;
- }
- static int CmdAdd(void)
- {
- Push(Pop()+Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdSubtract(void)
- {
- int operand2;
- operand2 = Pop();
- Push(Pop()-operand2);
- return SCRIPT_CONTINUE;
- }
- static int CmdMultiply(void)
- {
- Push(Pop()*Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdDivide(void)
- {
- int operand2;
- operand2 = Pop();
- Push(Pop()/operand2);
- return SCRIPT_CONTINUE;
- }
- static int CmdModulus(void)
- {
- int operand2;
- operand2 = Pop();
- Push(Pop()%operand2);
- return SCRIPT_CONTINUE;
- }
- static int CmdEQ(void)
- {
- Push(Pop() == Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdNE(void)
- {
- Push(Pop() != Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdLT(void)
- {
- int operand2;
- operand2 = Pop();
- Push(Pop() < operand2);
- return SCRIPT_CONTINUE;
- }
- static int CmdGT(void)
- {
- int operand2;
- operand2 = Pop();
- Push(Pop() > operand2);
- return SCRIPT_CONTINUE;
- }
- static int CmdLE(void)
- {
- int operand2;
- operand2 = Pop();
- Push(Pop() <= operand2);
- return SCRIPT_CONTINUE;
- }
- static int CmdGE(void)
- {
- int operand2;
- operand2 = Pop();
- Push(Pop() >= operand2);
- return SCRIPT_CONTINUE;
- }
- static int CmdAssignScriptVar(void)
- {
- ACScript->vars[*PCodePtr++] = Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdAssignMapVar(void)
- {
- MapVars[*PCodePtr++] = Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdAssignWorldVar(void)
- {
- WorldVars[*PCodePtr++] = Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdPushScriptVar(void)
- {
- Push(ACScript->vars[*PCodePtr++]);
- return SCRIPT_CONTINUE;
- }
- static int CmdPushMapVar(void)
- {
- Push(MapVars[*PCodePtr++]);
- return SCRIPT_CONTINUE;
- }
- static int CmdPushWorldVar(void)
- {
- Push(WorldVars[*PCodePtr++]);
- return SCRIPT_CONTINUE;
- }
- static int CmdAddScriptVar(void)
- {
- ACScript->vars[*PCodePtr++] += Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdAddMapVar(void)
- {
- MapVars[*PCodePtr++] += Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdAddWorldVar(void)
- {
- WorldVars[*PCodePtr++] += Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdSubScriptVar(void)
- {
- ACScript->vars[*PCodePtr++] -= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdSubMapVar(void)
- {
- MapVars[*PCodePtr++] -= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdSubWorldVar(void)
- {
- WorldVars[*PCodePtr++] -= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdMulScriptVar(void)
- {
- ACScript->vars[*PCodePtr++] *= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdMulMapVar(void)
- {
- MapVars[*PCodePtr++] *= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdMulWorldVar(void)
- {
- WorldVars[*PCodePtr++] *= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdDivScriptVar(void)
- {
- ACScript->vars[*PCodePtr++] /= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdDivMapVar(void)
- {
- MapVars[*PCodePtr++] /= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdDivWorldVar(void)
- {
- WorldVars[*PCodePtr++] /= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdModScriptVar(void)
- {
- ACScript->vars[*PCodePtr++] %= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdModMapVar(void)
- {
- MapVars[*PCodePtr++] %= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdModWorldVar(void)
- {
- WorldVars[*PCodePtr++] %= Pop();
- return SCRIPT_CONTINUE;
- }
- static int CmdIncScriptVar(void)
- {
- ACScript->vars[*PCodePtr++]++;
- return SCRIPT_CONTINUE;
- }
- static int CmdIncMapVar(void)
- {
- MapVars[*PCodePtr++]++;
- return SCRIPT_CONTINUE;
- }
- static int CmdIncWorldVar(void)
- {
- WorldVars[*PCodePtr++]++;
- return SCRIPT_CONTINUE;
- }
- static int CmdDecScriptVar(void)
- {
- ACScript->vars[*PCodePtr++]--;
- return SCRIPT_CONTINUE;
- }
- static int CmdDecMapVar(void)
- {
- MapVars[*PCodePtr++]--;
- return SCRIPT_CONTINUE;
- }
- static int CmdDecWorldVar(void)
- {
- WorldVars[*PCodePtr++]--;
- return SCRIPT_CONTINUE;
- }
- static int CmdGoto(void)
- {
- PCodePtr = (int *)(ActionCodeBase+*PCodePtr);
- return SCRIPT_CONTINUE;
- }
- static int CmdIfGoto(void)
- {
- if(Pop())
- {
- PCodePtr = (int *)(ActionCodeBase+*PCodePtr);
- }
- else
- {
- PCodePtr++;
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdDrop(void)
- {
- Drop();
- return SCRIPT_CONTINUE;
- }
- static int CmdDelay(void)
- {
- ACScript->delayCount = Pop();
- return SCRIPT_STOP;
- }
- static int CmdDelayDirect(void)
- {
- ACScript->delayCount = *PCodePtr++;
- return SCRIPT_STOP;
- }
- static int CmdRandom(void)
- {
- int low;
- int high;
- high = Pop();
- low = Pop();
- Push(low+(P_Random()%(high-low+1)));
- return SCRIPT_CONTINUE;
- }
- static int CmdRandomDirect(void)
- {
- int low;
- int high;
- low = *PCodePtr++;
- high = *PCodePtr++;
- Push(low+(P_Random()%(high-low+1)));
- return SCRIPT_CONTINUE;
- }
- static int CmdThingCount(void)
- {
- int tid;
- tid = Pop();
- ThingCount(Pop(), tid);
- return SCRIPT_CONTINUE;
- }
- static int CmdThingCountDirect(void)
- {
- int type;
- type = *PCodePtr++;
- ThingCount(type, *PCodePtr++);
- return SCRIPT_CONTINUE;
- }
- static void ThingCount(int type, int tid)
- {
- int count;
- int searcher;
- mobj_t *mobj;
- mobjtype_t moType;
- thinker_t *think;
- if(!(type+tid))
- { // Nothing to count
- return;
- }
- moType = TranslateThingType[type];
- count = 0;
- searcher = -1;
- if(tid)
- { // Count TID things
- while((mobj = P_FindMobjFromTID(tid, &searcher)) != NULL)
- {
- if(type == 0)
- { // Just count TIDs
- count++;
- }
- else if(moType == mobj->type)
- {
- if(mobj->flags&MF_COUNTKILL && mobj->health <= 0)
- { // Don't count dead monsters
- continue;
- }
- count++;
- }
- }
- }
- else
- { // Count only types
- for(think = thinkercap.next; think != &thinkercap;
- think = think->next)
- {
- if(think->function != P_MobjThinker)
- { // Not a mobj thinker
- continue;
- }
- mobj = (mobj_t *)think;
- if(mobj->type != moType)
- { // Doesn't match
- continue;
- }
- if(mobj->flags&MF_COUNTKILL && mobj->health <= 0)
- { // Don't count dead monsters
- continue;
- }
- count++;
- }
- }
- Push(count);
- }
- static int CmdTagWait(void)
- {
- ACSInfo[ACScript->infoIndex].waitValue = Pop();
- ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORTAG;
- return SCRIPT_STOP;
- }
- static int CmdTagWaitDirect(void)
- {
- ACSInfo[ACScript->infoIndex].waitValue = *PCodePtr++;
- ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORTAG;
- return SCRIPT_STOP;
- }
- static int CmdPolyWait(void)
- {
- ACSInfo[ACScript->infoIndex].waitValue = Pop();
- ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORPOLY;
- return SCRIPT_STOP;
- }
- static int CmdPolyWaitDirect(void)
- {
- ACSInfo[ACScript->infoIndex].waitValue = *PCodePtr++;
- ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORPOLY;
- return SCRIPT_STOP;
- }
- static int CmdChangeFloor(void)
- {
- int tag;
- int flat;
- int sectorIndex;
- flat = R_FlatNumForName(ACStrings[Pop()]);
- tag = Pop();
- sectorIndex = -1;
- while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0)
- {
- sectors[sectorIndex].floorpic = flat;
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdChangeFloorDirect(void)
- {
- int tag;
- int flat;
- int sectorIndex;
- tag = *PCodePtr++;
- flat = R_FlatNumForName(ACStrings[*PCodePtr++]);
- sectorIndex = -1;
- while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0)
- {
- sectors[sectorIndex].floorpic = flat;
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdChangeCeiling(void)
- {
- int tag;
- int flat;
- int sectorIndex;
- flat = R_FlatNumForName(ACStrings[Pop()]);
- tag = Pop();
- sectorIndex = -1;
- while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0)
- {
- sectors[sectorIndex].ceilingpic = flat;
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdChangeCeilingDirect(void)
- {
- int tag;
- int flat;
- int sectorIndex;
- tag = *PCodePtr++;
- flat = R_FlatNumForName(ACStrings[*PCodePtr++]);
- sectorIndex = -1;
- while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0)
- {
- sectors[sectorIndex].ceilingpic = flat;
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdRestart(void)
- {
- PCodePtr = ACSInfo[ACScript->infoIndex].address;
- return SCRIPT_CONTINUE;
- }
- static int CmdAndLogical(void)
- {
- Push(Pop() && Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdOrLogical(void)
- {
- Push(Pop() || Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdAndBitwise(void)
- {
- Push(Pop()&Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdOrBitwise(void)
- {
- Push(Pop()|Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdEorBitwise(void)
- {
- Push(Pop()^Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdNegateLogical(void)
- {
- Push(!Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdLShift(void)
- {
- int operand2;
- operand2 = Pop();
- Push(Pop()<<operand2);
- return SCRIPT_CONTINUE;
- }
- static int CmdRShift(void)
- {
- int operand2;
- operand2 = Pop();
- Push(Pop()>>operand2);
- return SCRIPT_CONTINUE;
- }
- static int CmdUnaryMinus(void)
- {
- Push(-Pop());
- return SCRIPT_CONTINUE;
- }
- static int CmdIfNotGoto(void)
- {
- if(Pop())
- {
- PCodePtr++;
- }
- else
- {
- PCodePtr = (int *)(ActionCodeBase+*PCodePtr);
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdLineSide(void)
- {
- Push(ACScript->side);
- return SCRIPT_CONTINUE;
- }
- static int CmdScriptWait(void)
- {
- ACSInfo[ACScript->infoIndex].waitValue = Pop();
- ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORSCRIPT;
- return SCRIPT_STOP;
- }
- static int CmdScriptWaitDirect(void)
- {
- ACSInfo[ACScript->infoIndex].waitValue = *PCodePtr++;
- ACSInfo[ACScript->infoIndex].state = ASTE_WAITINGFORSCRIPT;
- return SCRIPT_STOP;
- }
- static int CmdClearLineSpecial(void)
- {
- if(ACScript->line)
- {
- ACScript->line->special = 0;
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdCaseGoto(void)
- {
- if(Top() == *PCodePtr++)
- {
- PCodePtr = (int *)(ActionCodeBase+*PCodePtr);
- Drop();
- }
- else
- {
- PCodePtr++;
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdBeginPrint(void)
- {
- *PrintBuffer = 0;
- return SCRIPT_CONTINUE;
- }
- static int CmdEndPrint(void)
- {
- player_t *player;
- if(ACScript->activator && ACScript->activator->player)
- {
- player = ACScript->activator->player;
- }
- else
- {
- player = &players[consoleplayer];
- }
- P_SetMessage(player, PrintBuffer, true);
- return SCRIPT_CONTINUE;
- }
- static int CmdEndPrintBold(void)
- {
- int i;
- for(i = 0; i < MAXPLAYERS; i++)
- {
- if(playeringame[i])
- {
- P_SetYellowMessage(&players[i], PrintBuffer, true);
- }
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdPrintString(void)
- {
- strcat(PrintBuffer, ACStrings[Pop()]);
- return SCRIPT_CONTINUE;
- }
- static int CmdPrintNumber(void)
- {
- char tempStr[16];
- sprintf(tempStr, "%d", Pop());
- strcat(PrintBuffer, tempStr);
- return SCRIPT_CONTINUE;
- }
- static int CmdPrintCharacter(void)
- {
- char *bufferEnd;
- bufferEnd = PrintBuffer+strlen(PrintBuffer);
- *bufferEnd++ = Pop();
- *bufferEnd = 0;
- return SCRIPT_CONTINUE;
- }
- static int CmdPlayerCount(void)
- {
- int i;
- int count;
- count = 0;
- for(i = 0; i < MAXPLAYERS; i++)
- {
- count += playeringame[i];
- }
- Push(count);
- return SCRIPT_CONTINUE;
- }
- static int CmdGameType(void)
- {
- int gametype;
- if(netgame == false)
- {
- gametype = GAME_SINGLE_PLAYER;
- }
- else if(deathmatch)
- {
- gametype = GAME_NET_DEATHMATCH;
- }
- else
- {
- gametype = GAME_NET_COOPERATIVE;
- }
- Push(gametype);
- return SCRIPT_CONTINUE;
- }
- static int CmdGameSkill(void)
- {
- Push(gameskill);
- return SCRIPT_CONTINUE;
- }
- static int CmdTimer(void)
- {
- Push(leveltime);
- return SCRIPT_CONTINUE;
- }
- static int CmdSectorSound(void)
- {
- int volume;
- mobj_t *mobj;
- mobj = NULL;
- if(ACScript->line)
- {
- mobj = (mobj_t *)&ACScript->line->frontsector->soundorg;
- }
- volume = Pop();
- S_StartSoundAtVolume(mobj, S_GetSoundID(ACStrings[Pop()]), volume);
- return SCRIPT_CONTINUE;
- }
- static int CmdThingSound(void)
- {
- int tid;
- int sound;
- int volume;
- mobj_t *mobj;
- int searcher;
- volume = Pop();
- sound = S_GetSoundID(ACStrings[Pop()]);
- tid = Pop();
- searcher = -1;
- while((mobj = P_FindMobjFromTID(tid, &searcher)) != NULL)
- {
- S_StartSoundAtVolume(mobj, sound, volume);
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdAmbientSound(void)
- {
- int volume;
- volume = Pop();
- S_StartSoundAtVolume(NULL, S_GetSoundID(ACStrings[Pop()]), volume);
- return SCRIPT_CONTINUE;
- }
- static int CmdSoundSequence(void)
- {
- mobj_t *mobj;
- mobj = NULL;
- if(ACScript->line)
- {
- mobj = (mobj_t *)&ACScript->line->frontsector->soundorg;
- }
- SN_StartSequenceName(mobj, ACStrings[Pop()]);
- return SCRIPT_CONTINUE;
- }
- static int CmdSetLineTexture(void)
- {
- line_t *line;
- int lineTag;
- int side;
- int position;
- int texture;
- int searcher;
- texture = R_TextureNumForName(ACStrings[Pop()]);
- position = Pop();
- side = Pop();
- lineTag = Pop();
- searcher = -1;
- while((line = P_FindLine(lineTag, &searcher)) != NULL)
- {
- if(position == TEXTURE_MIDDLE)
- {
- sides[line->sidenum[side]].midtexture = texture;
- }
- else if(position == TEXTURE_BOTTOM)
- {
- sides[line->sidenum[side]].bottomtexture = texture;
- }
- else
- { // TEXTURE_TOP
- sides[line->sidenum[side]].toptexture = texture;
- }
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdSetLineBlocking(void)
- {
- line_t *line;
- int lineTag;
- boolean blocking;
- int searcher;
- blocking = Pop() ? ML_BLOCKING : 0;
- lineTag = Pop();
- searcher = -1;
- while((line = P_FindLine(lineTag, &searcher)) != NULL)
- {
- line->flags = (line->flags&~ML_BLOCKING)|blocking;
- }
- return SCRIPT_CONTINUE;
- }
- static int CmdSetLineSpecial(void)
- {
- line_t *line;
- int lineTag;
- int special, arg1, arg2, arg3, arg4, arg5;
- int searcher;
- arg5 = Pop();
- arg4 = Pop();
- arg3 = Pop();
- arg2 = Pop();
- arg1 = Pop();
- special = Pop();
- lineTag = Pop();
- searcher = -1;
- while((line = P_FindLine(lineTag, &searcher)) != NULL)
- {
- line->special = special;
- line->arg1 = arg1;
- line->arg2 = arg2;
- line->arg3 = arg3;
- line->arg4 = arg4;
- line->arg5 = arg5;
- }
- return SCRIPT_CONTINUE;
- }
|