From af30e933e4364dbc3e15b9590b75d71d7c114b3f Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 11 Jun 2012 21:46:47 +0000 Subject: [PATCH] - Fixed: Direct instructions need to tag their strings before lookup. SVN r3686 (trunk) --- src/p_acs.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 857eba9d5..0ca7e9d15 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3895,6 +3895,8 @@ enum #define NEXTSHORT (fmt==ACS_LittleEnhanced?getshort(pc):NEXTWORD) #define STACK(a) (Stack[sp - (a)]) #define PushToStack(a) (Stack[sp++] = (a)) +// Direct instructions that take strings need to have the tag applied. +#define TAGSTR(a) (a|activeBehavior->GetLibraryID()) inline int getbyte (int *&pc) { @@ -5188,7 +5190,7 @@ int DLevelScript::RunScript () break; case PCD_CHANGEFLOORDIRECT: - ChangeFlat (uallong(pc[0]), uallong(pc[1]), 0); + ChangeFlat (uallong(pc[0]), TAGSTR(uallong(pc[1])), 0); pc += 2; break; @@ -5198,7 +5200,7 @@ int DLevelScript::RunScript () break; case PCD_CHANGECEILINGDIRECT: - ChangeFlat (uallong(pc[0]), uallong(pc[1]), 1); + ChangeFlat (uallong(pc[0]), TAGSTR(uallong(pc[1])), 1); pc += 2; break; @@ -5702,7 +5704,7 @@ int DLevelScript::RunScript () break; case PCD_SETFONTDIRECT: - DoSetFont (uallong(pc[0])); + DoSetFont (TAGSTR(uallong(pc[0]))); pc++; break; @@ -6034,7 +6036,7 @@ int DLevelScript::RunScript () break; case PCD_SPAWNDIRECT: - PushToStack (DoSpawn (uallong(pc[0]), uallong(pc[1]), uallong(pc[2]), uallong(pc[3]), uallong(pc[4]), uallong(pc[5]), false)); + PushToStack (DoSpawn (TAGSTR(uallong(pc[0])), uallong(pc[1]), uallong(pc[2]), uallong(pc[3]), uallong(pc[4]), uallong(pc[5]), false)); pc += 6; break; @@ -6044,7 +6046,7 @@ int DLevelScript::RunScript () break; case PCD_SPAWNSPOTDIRECT: - PushToStack (DoSpawnSpot (uallong(pc[0]), uallong(pc[1]), uallong(pc[2]), uallong(pc[3]), false)); + PushToStack (DoSpawnSpot (TAGSTR(uallong(pc[0])), uallong(pc[1]), uallong(pc[2]), uallong(pc[3]), false)); pc += 4; break; @@ -6100,7 +6102,7 @@ int DLevelScript::RunScript () break; case PCD_GIVEINVENTORYDIRECT: - GiveInventory (activator, FBehavior::StaticLookupString (uallong(pc[0])), uallong(pc[1])); + GiveInventory (activator, FBehavior::StaticLookupString (TAGSTR(uallong(pc[0]))), uallong(pc[1])); pc += 2; break; @@ -6130,7 +6132,7 @@ int DLevelScript::RunScript () break; case PCD_TAKEINVENTORYDIRECT: - TakeInventory (activator, FBehavior::StaticLookupString (uallong(pc[0])), uallong(pc[1])); + TakeInventory (activator, FBehavior::StaticLookupString (TAGSTR(uallong(pc[0]))), uallong(pc[1])); pc += 2; break; @@ -6145,7 +6147,7 @@ int DLevelScript::RunScript () break; case PCD_CHECKINVENTORYDIRECT: - PushToStack (CheckInventory (activator, FBehavior::StaticLookupString (uallong(pc[0])))); + PushToStack (CheckInventory (activator, FBehavior::StaticLookupString (TAGSTR(uallong(pc[0]))))); pc += 1; break; @@ -6249,7 +6251,7 @@ int DLevelScript::RunScript () break; case PCD_SETMUSICDIRECT: - S_ChangeMusic (FBehavior::StaticLookupString (uallong(pc[0])), uallong(pc[1])); + S_ChangeMusic (FBehavior::StaticLookupString (TAGSTR(uallong(pc[0]))), uallong(pc[1])); pc += 3; break; @@ -6264,7 +6266,7 @@ int DLevelScript::RunScript () case PCD_LOCALSETMUSICDIRECT: if (activator == players[consoleplayer].mo) { - S_ChangeMusic (FBehavior::StaticLookupString (uallong(pc[0])), uallong(pc[1])); + S_ChangeMusic (FBehavior::StaticLookupString (TAGSTR(uallong(pc[0]))), uallong(pc[1])); } pc += 3; break;