From 0528fe0539437e861622f5ee5f1f312e510f158e Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 24 Oct 2022 22:33:23 +1000 Subject: [PATCH] Re-ID AI commands so the most common commands can be identified by the first byte only --- src/game/chrai.c | 2603 ++++++--------------------------------- src/game/gailists.c | 2 - src/include/commands.h | 1475 +++++----------------- src/include/constants.h | 6 +- src/lib/ailist.c | 615 +++++---- src/setups/setupame.c | 1 - src/setups/setupoat.c | 1 - src/setups/setupold.c | 125 -- src/setups/setupwax.c | 1 - 9 files changed, 1074 insertions(+), 3755 deletions(-) diff --git a/src/game/chrai.c b/src/game/chrai.c index 23f3ba1cf..32105c4dd 100644 --- a/src/game/chrai.c +++ b/src/game/chrai.c @@ -52,130 +52,6 @@ #include "lib/snd.h" #include "types.h" -u16 g_CommandLengths[] = { - /*0x0000*/ 3, /*0x0001*/ 3, /*0x0002*/ 3, /*0x0003*/ 2, - /*0x0004*/ 2, /*0x0005*/ 5, /*0x0006*/ 5, /*0x0007*/ 4, - /*0x0008*/ 2, /*0x0009*/ 2, /*0x000a*/ 2, /*0x000b*/ 12, - /*0x000c*/ 3, /*0x000d*/ 2, /*0x000e*/ 2, /*0x000f*/ 3, - /*0x0010*/ 3, /*0x0011*/ 3, /*0x0012*/ 3, /*0x0013*/ 3, - /*0x0014*/ 3, /*0x0015*/ 7, /*0x0016*/ 7, /*0x0017*/ 7, - /*0x0018*/ 7, /*0x0019*/ 8, /*0x001a*/ 5, /*0x001b*/ 7, - /*0x001c*/ 6, /*0x001d*/ 4, /*0x001e*/ 3, /*0x001f*/ 4, - /*0x0020*/ 4, /*0x0021*/ 3, /*0x0022*/ 2, /*0x0023*/ 3, - /*0x0024*/ 2, /*0x0025*/ 2, /*0x0026*/ 3, /*0x0027*/ 5, - /*0x0028*/ 2, /*0x0029*/ 2, /*0x002a*/ 3, /*0x002b*/ 3, - /*0x002c*/ 3, /*0x002d*/ 3, /*0x002e*/ 3, /*0x002f*/ 4, - /*0x0030*/ 4, /*0x0031*/ 4, /*0x0032*/ 3, /*0x0033*/ 4, - /*0x0034*/ 4, /*0x0035*/ 3, /*0x0036*/ 2, /*0x0037*/ 4, - /*0x0038*/ 4, /*0x0039*/ 3, /*0x003a*/ 3, /*0x003b*/ 3, - /*0x003c*/ 3, /*0x003d*/ 4, /*0x003e*/ 4, /*0x003f*/ 3, - /*0x0040*/ 7, /*0x0041*/ 7, /*0x0042*/ 3, /*0x0043*/ 3, - /*0x0044*/ 3, /*0x0045*/ 4, /*0x0046*/ 3, /*0x0047*/ 3, - /*0x0048*/ 4, /*0x0049*/ 5, /*0x004a*/ 3, /*0x004b*/ 3, - /*0x004c*/ 3, /*0x004d*/ 4, /*0x004e*/ 6, /*0x004f*/ 4, - /*0x0050*/ 4, /*0x0051*/ 4, /*0x0052*/ 5, /*0x0053*/ 5, - /*0x0054*/ 8, /*0x0055*/ 8, /*0x0056*/ 6, /*0x0057*/ 6, - /*0x0058*/ 5, /*0x0059*/ 7, /*0x005a*/ 7, /*0x005b*/ 7, - /*0x005c*/ 5, /*0x005d*/ 5, /*0x005e*/ 4, /*0x005f*/ 5, - /*0x0060*/ 5, /*0x0061*/ 5, /*0x0062*/ 4, /*0x0063*/ 5, - /*0x0064*/ 1, /*0x0065*/ 3, /*0x0066*/ 3, /*0x0067*/ 3, - /*0x0068*/ 3, /*0x0069*/ 3, /*0x006a*/ 4, /*0x006b*/ 5, - /*0x006c*/ 3, /*0x006d*/ 3, /*0x006e*/ 5, /*0x006f*/ 4, - /*0x0070*/ 4, /*0x0071*/ 4, /*0x0072*/ 5, /*0x0073*/ 4, - /*0x0074*/ 4, /*0x0075*/ 4, /*0x0076*/ 4, /*0x0077*/ 4, - /*0x0078*/ 4, /*0x0079*/ 5, /*0x007a*/ 5, /*0x007b*/ 4, - /*0x007c*/ 4, /*0x007d*/ 4, /*0x007e*/ 4, /*0x007f*/ 4, - /*0x0080*/ 4, /*0x0081*/ 5, /*0x0082*/ 5, /*0x0083*/ 4, - /*0x0084*/ 3, /*0x0085*/ 3, /*0x0086*/ 4, /*0x0087*/ 3, - /*0x0088*/ 4, /*0x0089*/ 3, /*0x008a*/ 3, /*0x008b*/ 3, - /*0x008c*/ 4, /*0x008d*/ 3, /*0x008e*/ 5, /*0x008f*/ 5, - /*0x0090*/ 3, /*0x0091*/ 2, /*0x0092*/ 4, /*0x0093*/ 3, - /*0x0094*/ 3, /*0x0095*/ 3, /*0x0096*/ 5, /*0x0097*/ 4, - /*0x0098*/ 3, /*0x0099*/ 3, /*0x009a*/ 3, /*0x009b*/ 7, - /*0x009c*/ 7, /*0x009d*/ 9, /*0x009e*/ 8, /*0x009f*/ 8, - /*0x00a0*/ 9, /*0x00a1*/ 6, /*0x00a2*/ 6, /*0x00a3*/ 8, - /*0x00a4*/ 6, /*0x00a5*/ 6, /*0x00a6*/ 7, /*0x00a7*/ 7, - /*0x00a8*/ 7, /*0x00a9*/ 8, /*0x00aa*/ 7, /*0x00ab*/ 7, - /*0x00ac*/ 8, /*0x00ad*/ 7, /*0x00ae*/ 7, /*0x00af*/ 8, - /*0x00b0*/ 3, /*0x00b1*/ 4, /*0x00b2*/ 4, /*0x00b3*/ 5, - /*0x00b4*/ 4, /*0x00b5*/ 0, /*0x00b6*/ 2, /*0x00b7*/ 2, - /*0x00b8*/ 2, /*0x00b9*/ 2, /*0x00ba*/ 3, /*0x00bb*/ 3, - /*0x00bc*/ 6, /*0x00bd*/ 6, /*0x00be*/ 2, /*0x00bf*/ 2, - /*0x00c0*/ 4, /*0x00c1*/ 2, /*0x00c2*/ 2, /*0x00c3*/ 3, - /*0x00c4*/ 5, /*0x00c5*/ 5, /*0x00c6*/ 13, /*0x00c7*/ 12, - /*0x00c8*/ 10, /*0x00c9*/ 9, /*0x00ca*/ 10, /*0x00cb*/ 5, - /*0x00cc*/ 6, /*0x00cd*/ 9, /*0x00ce*/ 5, /*0x00cf*/ 6, - /*0x00d0*/ 7, /*0x00d1*/ 7, /*0x00d2*/ 7, /*0x00d3*/ 3, - /*0x00d4*/ 6, /*0x00d5*/ 3, /*0x00d6*/ 6, /*0x00d7*/ 6, - /*0x00d8*/ 3, /*0x00d9*/ 3, /*0x00da*/ 5, /*0x00db*/ 3, - /*0x00dc*/ 2, /*0x00dd*/ 2, /*0x00de*/ 4, /*0x00df*/ 7, - /*0x00e0*/ 4, /*0x00e1*/ 3, /*0x00e2*/ 7, /*0x00e3*/ 3, - /*0x00e4*/ 3, /*0x00e5*/ 4, /*0x00e6*/ 1, /*0x00e7*/ 1, - /*0x00e8*/ 3, /*0x00e9*/ 4, /*0x00ea*/ 4, /*0x00eb*/ 6, - /*0x00ec*/ 4, /*0x00ed*/ 4, /*0x00ee*/ 5, /*0x00ef*/ 6, - /*0x00f0*/ 3, /*0x00f1*/ 3, /*0x00f2*/ 2, /*0x00f3*/ 3, - /*0x00f4*/ 14, /*0x00f5*/ 2, /*0x00f6*/ 3, /*0x00f7*/ 3, - /*0x00f8*/ 4, /*0x00f9*/ 5, /*0x00fa*/ 3, /*0x00fb*/ 3, - /*0x00fc*/ 4, /*0x00fd*/ 4, /*0x00fe*/ 2, /*0x00ff*/ 2, - /*0x0100*/ 3, /*0x0101*/ 3, /*0x0102*/ 11, /*0x0103*/ 3, - /*0x0104*/ 2, /*0x0105*/ 5, /*0x0106*/ 5, /*0x0107*/ 3, - /*0x0108*/ 6, /*0x0109*/ 6, /*0x010a*/ 8, /*0x010b*/ 4, - /*0x010c*/ 4, /*0x010d*/ 2, /*0x010e*/ 4, /*0x010f*/ 6, - /*0x0110*/ 6, /*0x0111*/ 4, /*0x0112*/ 8, /*0x0113*/ 3, - /*0x0114*/ 3, /*0x0115*/ 3, /*0x0116*/ 3, /*0x0117*/ 3, - /*0x0118*/ 7, /*0x0119*/ 7, /*0x011a*/ 8, /*0x011b*/ 7, - /*0x011c*/ 7, /*0x011d*/ 8, /*0x011e*/ 4, /*0x011f*/ 4, - /*0x0120*/ 4, /*0x0121*/ 5, /*0x0122*/ 9, /*0x0123*/ 9, - /*0x0124*/ 3, /*0x0125*/ 3, /*0x0126*/ 3, /*0x0127*/ 3, - /*0x0128*/ 4, /*0x0129*/ 4, /*0x012a*/ 4, /*0x012b*/ 3, - /*0x012c*/ 3, /*0x012d*/ 1, /*0x012e*/ 1, /*0x012f*/ 2, - /*0x0130*/ 10, /*0x0131*/ 3, /*0x0132*/ 4, /*0x0133*/ 4, - /*0x0134*/ 5, /*0x0135*/ 3, /*0x0136*/ 4, /*0x0137*/ 4, - /*0x0138*/ 4, /*0x0139*/ 8, /*0x013a*/ 5, /*0x013b*/ 3, - /*0x013c*/ 3, /*0x013d*/ 4, /*0x013e*/ 2, /*0x013f*/ 3, - /*0x0140*/ 5, /*0x0141*/ 9, /*0x0142*/ 4, /*0x0143*/ 2, - /*0x0144*/ 2, /*0x0145*/ 2, /*0x0146*/ 2, /*0x0147*/ 4, - /*0x0148*/ 4, /*0x0149*/ 6, /*0x014a*/ 6, /*0x014b*/ 3, - /*0x014c*/ 1, /*0x014d*/ 1, /*0x014e*/ 1, /*0x014f*/ 1, - /*0x0150*/ 1, /*0x0151*/ 1, /*0x0152*/ 5, /*0x0153*/ 1, - /*0x0154*/ 1, /*0x0155*/ 1, /*0x0156*/ 1, /*0x0157*/ 3, - /*0x0158*/ 1, /*0x0159*/ 1, /*0x015a*/ 1, /*0x015b*/ 3, - /*0x015c*/ 2, /*0x015d*/ 1, /*0x015e*/ 1, /*0x015f*/ 1, - /*0x0160*/ 1, /*0x0161*/ 1, /*0x0162*/ 1, /*0x0163*/ 1, - /*0x0164*/ 1, /*0x0165*/ 4, /*0x0166*/ 4, /*0x0167*/ 3, - /*0x0168*/ 4, /*0x0169*/ 4, /*0x016a*/ 7, /*0x016b*/ 10, - /*0x016c*/ 2, /*0x016d*/ 5, /*0x016e*/ 5, /*0x016f*/ 5, - /*0x0170*/ 4, /*0x0171*/ 5, /*0x0172*/ 4, /*0x0173*/ 4, - /*0x0174*/ 3, /*0x0175*/ 3, /*0x0176*/ 3, /*0x0177*/ 9, - /*0x0178*/ 4, /*0x0179*/ 11, /*0x017a*/ 3, /*0x017b*/ 4, - /*0x017c*/ 5, /*0x017d*/ 3, /*0x017e*/ 2, /*0x017f*/ 3, - /*0x0180*/ 2, /*0x0181*/ 5, /*0x0182*/ 4, /*0x0183*/ 3, - /*0x0184*/ 4, /*0x0185*/ 2, /*0x0186*/ 6, /*0x0187*/ 3, - /*0x0188*/ 4, /*0x0189*/ 4, /*0x018a*/ 5, /*0x018b*/ 3, - /*0x018c*/ 4, /*0x018d*/ 4, /*0x018e*/ 7, /*0x018f*/ 8, - /*0x0190*/ 3, /*0x0191*/ 3, /*0x0192*/ 4, /*0x0193*/ 4, - /*0x0194*/ 1, /*0x0195*/ 1, /*0x0196*/ 1, /*0x0197*/ 1, - /*0x0198*/ 1, /*0x0199*/ 1, /*0x019a*/ 1, /*0x019b*/ 1, - /*0x019c*/ 1, /*0x019d*/ 1, /*0x019e*/ 6, /*0x019f*/ 5, - /*0x01a0*/ 4, /*0x01a1*/ 2, /*0x01a2*/ 4, /*0x01a3*/ 3, - /*0x01a4*/ 6, /*0x01a5*/ 3, /*0x01a6*/ 4, /*0x01a7*/ 4, - /*0x01a8*/ 1, /*0x01a9*/ 1, /*0x01aa*/ 3, /*0x01ab*/ 5, - /*0x01ac*/ 1, /*0x01ad*/ 3, /*0x01ae*/ 3, /*0x01af*/ 4, - /*0x01b0*/ 1, /*0x01b1*/ 18, /*0x01b2*/ 3, /*0x01b3*/ 3, - /*0x01b4*/ 3, /*0x01b5*/ 4, /*0x01b6*/ 3, /*0x01b7*/ 5, - /*0x01b8*/ 4, /*0x01b9*/ 2, /*0x01ba*/ 7, /*0x01bb*/ 4, - /*0x01bc*/ 4, /*0x01bd*/ 3, /*0x01be*/ 5, /*0x01bf*/ 5, - /*0x01c0*/ 4, /*0x01c1*/ 4, /*0x01c2*/ 4, /*0x01c3*/ 4, - /*0x01c4*/ 4, /*0x01c5*/ 2, /*0x01c6*/ 4, /*0x01c7*/ 3, - /*0x01c8*/ 3, /*0x01c9*/ 3, /*0x01ca*/ 5, /*0x01cb*/ 8, - /*0x01cc*/ 3, /*0x01cd*/ 4, /*0x01ce*/ 3, /*0x01cf*/ 4, - /*0x01d0*/ 5, /*0x01d1*/ 5, /*0x01d2*/ 3, /*0x01d3*/ 5, - /*0x01d4*/ 6, /*0x01d5*/ 3, /*0x01d6*/ 6, /*0x01d7*/ 5, - /*0x01d8*/ 5, /*0x01d9*/ 11, /*0x01da*/ 3, /*0x01db*/ 3, - /*0x01dc*/ 3, /*0x01dd*/ 4, /*0x01de*/ 3, /*0x01df*/ 8, - /*0x01e0*/ 2, -}; - /** * @cmd 0000 */ @@ -371,22 +247,6 @@ const char var7f1a9bcc[] = "couldn't find cover from danger !\n"; const char var7f1a9bf0[] = "Randnum = %d, Alarmrandnum = %d \n"; const char var7f1a9c18[] = "IVE FOUND MY PAD %d \n"; -/** - * @cmd 01c1 - */ -static u8 *aiSetPunchDodgeList(u8 *cmd) -{ - u16 ailistid = cmd[3] | (cmd[2] << 8); - - if (g_Vars.chrdata) { - g_Vars.chrdata->aipunchdodgelist = ailistid; - } - - cmd += 4; - - return cmd; -} - /** * @cmd 01c2 */ @@ -419,22 +279,6 @@ static u8 *aiSetDarkRoomList(u8 *cmd) return cmd; } -/** - * @cmd 01c4 - */ -static u8 *aiSetPlayerDeadList(u8 *cmd) -{ - u16 ailistid = cmd[3] | (cmd[2] << 8); - - if (g_Vars.chrdata) { - g_Vars.chrdata->aiplayerdeadlist = ailistid; - } - - cmd += 4; - - return cmd; -} - /** * @cmd 0008 */ @@ -575,28 +419,6 @@ bool func0f04e418(void) return false; } -/** - * @cmd 000d - */ -static u8 *aiBeSurprisedOneHand(u8 *cmd) -{ - chrTrySurprisedOneHand(g_Vars.chrdata); - cmd += 2; - - return cmd; -} - -/** - * @cmd 000e - */ -static u8 *aiBeSurprisedLookAround(u8 *cmd) -{ - chrTrySurprisedLookAround(g_Vars.chrdata); - cmd += 2; - - return cmd; -} - /** * @cmd 0032 */ @@ -742,20 +564,6 @@ static u8 *aiTryAttackWalk(u8 *cmd) return cmd; } -/** - * @cmd 0013 - */ -static u8 *aiTryAttackRun(u8 *cmd) -{ - if (chrTryAttackRun(g_Vars.chrdata)) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 0014 */ @@ -821,36 +629,6 @@ static u8 *aiTryAttackLie(u8 *cmd) return cmd; } -/** - * @cmd 00f0 - */ -static u8 *ai00f0(u8 *cmd) -{ - if (g_Vars.chrdata->actiontype == ACT_ATTACK && - !g_Vars.chrdata->act_attack.reaim && - g_Vars.chrdata->act_attack.flags & ATTACKFLAG_DONTTURN) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - -/** - * @cmd 00f1 - */ -static u8 *aiIfAttacking(u8 *cmd) -{ - if (g_Vars.chrdata->actiontype == ACT_ATTACK) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 0017 */ @@ -955,22 +733,6 @@ static u8 *aiConsiderGrenadeThrow(u8 *cmd) return cmd; } -/** - * @cmd 001c - */ -static u8 *aiDropItem(u8 *cmd) -{ - u32 modelnum = cmd[3] | (cmd[2] << 8); - - if (chrDropItem(g_Vars.chrdata, modelnum & 0xffff, cmd[4] & 0xff)) { - cmd = AILABEL(g_Vars.ailist, cmd[5], cmd[6]); - } else { - cmd += 7; - } - - return cmd; -} - /** * @cmd 0024 */ @@ -1009,22 +771,6 @@ static u8 *aiRemoveChr(u8 *cmd) return cmd; } -/** - * @cmd 0027 - */ -static u8 *aiTryStartAlarm(u8 *cmd) -{ - u16 pad_id = cmd[3] | (cmd[2] << 8); - - if (chrTryStartAlarm(g_Vars.chrdata, pad_id)) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - /** * @cmd 0028 */ @@ -1047,20 +793,6 @@ static u8 *aiDeactivateAlarm(u8 *cmd) return cmd; } -/** - * @cmd 002a - */ -static u8 *aiTryRunFromTarget(u8 *cmd) -{ - if (chrTryRunFromTarget(g_Vars.chrdata)) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 002b */ @@ -1103,20 +835,6 @@ static u8 *aiTryRunToTargetProp(u8 *cmd) return cmd; } -/** - * @cmd 002e - */ -static u8 *aiTryGoToCoverProp(u8 *cmd) -{ - if (chrGoToCoverProp(g_Vars.chrdata)) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 002f */ @@ -1131,20 +849,6 @@ static u8 *aiTryJogToChr(u8 *cmd) return cmd; } -/** - * @cmd 0030 - */ -static u8 *aiTryWalkToChr(u8 *cmd) -{ - if (chrGoToChr(g_Vars.chrdata, cmd[2], GOPOSFLAG_WALK)) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 0031 */ @@ -1326,20 +1030,6 @@ static u8 *aiIfAlarmActive(u8 *cmd) return cmd; } -/** - * @cmd 003b - */ -static u8 *aiIfGasActive(u8 *cmd) -{ - if (gasIsActive()) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 003c */ @@ -1412,22 +1102,6 @@ static u8 *aiIfCanSeeAttackTarget(u8 *cmd) return cmd; } -/** - * @cmd 0040 - */ -static u8 *aiIfTargetNearlyInSight(u8 *cmd) -{ - u32 distance = (cmd[3] << 16) | (cmd[4] << 8) | cmd[5] | (cmd[2] << 24); - - if (chrIsTargetNearlyInSight(g_Vars.chrdata, distance)) { - cmd = AILABEL(g_Vars.ailist, cmd[6], cmd[7]); - } else { - cmd += 8; - } - - return cmd; -} - /** * @cmd 0041 */ @@ -1444,34 +1118,6 @@ static u8 *aiIfNearlyInTargetsSight(u8 *cmd) return cmd; } -/** - * @cmd 0042 - */ -static u8 *aiSetPadPresetToPadOnRouteToTarget(u8 *cmd) -{ - if (chrSetPadPresetToPadOnRouteToTarget(g_Vars.chrdata)) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - -/** - * @cmd 0043 - */ -static u8 *aiIfSawTargetRecently(u8 *cmd) -{ - if (chrSawTargetRecently(g_Vars.chrdata)) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 0044 */ @@ -1530,32 +1176,6 @@ static u8 *aiIfOnScreen(u8 *cmd) return cmd; } -/** - * @cmd 0048 - */ -static u8 *aiIfChrInOnScreenRoom(u8 *cmd) -{ - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - u8 pass = false; - s32 i; - - if (chr && chr->prop) { - for (i = 0; chr->prop->rooms[i] != -1; i++) { - if (roomIsOnscreen(chr->prop->rooms[i])) { - pass = true; - } - } - } - - if (pass) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 0049 */ @@ -1716,20 +1336,6 @@ static u8 *aiIfTargetInFov(u8 *cmd) return cmd; } -/** - * @cmd 0051 - */ -static u8 *aiIfTargetOutOfFov(u8 *cmd) -{ - if (!chrIsTargetInFov(g_Vars.chrdata, cmd[2], 0)) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 0052 */ @@ -1887,22 +1493,6 @@ static u8 *aiIfDistanceToChrGreaterThan(u8 *cmd) return cmd; } -/** - * @cmd 0058 - */ -static u8 *ai0058(u8 *cmd) -{ - f32 distance = (cmd[3] | (cmd[2] << 8)) * 10.0f; - - if (chrSetChrPresetToAnyChrNearSelf(g_Vars.chrdata, distance)) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - /** * @cmd 0059 */ @@ -1920,23 +1510,6 @@ static u8 *aiIfDistanceFromTargetToPadLessThan(u8 *cmd) return cmd; } -/** - * @cmd 005a - */ -static u8 *aiIfDistanceFromTargetToPadGreaterThan(u8 *cmd) -{ - u16 pad = cmd[5] | (cmd[4] << 8); - f32 value = (cmd[3] | (cmd[2] << 8)) * 10.0f; - - if (chrGetDistanceFromTargetToPad(g_Vars.chrdata, pad) > value) { - cmd = AILABEL(g_Vars.ailist, cmd[6], cmd[7]); - } else { - cmd += 8; - } - - return cmd; -} - /** * @cmd 005b */ @@ -1982,24 +1555,6 @@ static u8 *aiIfChrInRoom(u8 *cmd) return cmd; } -/** - * @cmd 005c - */ -static u8 *aiIfTargetInRoom(u8 *cmd) -{ - struct prop *prop = chrGetTargetProp(g_Vars.chrdata); - u16 pad_id = cmd[3] | (cmd[2] << 8); - s32 room_id = chrGetPadRoom(g_Vars.chrdata, pad_id); - - if (room_id >= 0 && prop && room_id == prop->rooms[0]) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - /** * @cmd 005d */ @@ -2184,26 +1739,6 @@ static u8 *aiIfChrActivatedObject(u8 *cmd) return cmd; } -/** - * @cmd 0065 - */ -static u8 *aiObjInteract(u8 *cmd) -{ - struct defaultobj *obj = objFindByTagId(cmd[2]); - - if (obj && obj->prop) { - if (obj->prop->type == PROPTYPE_DOOR) { - doorsActivate(obj->prop, false); - } else if (obj->prop->type == PROPTYPE_OBJ || obj->prop->type == PROPTYPE_WEAPON) { - propobjInteract(obj->prop); - } - } - - cmd += 3; - - return cmd; -} - /** * @cmd 0066 */ @@ -2229,24 +1764,6 @@ static u8 *aiDestroyObject(u8 *cmd) return cmd; } -/** - * @cmd 0067 - */ -static u8 *ai0067(u8 *cmd) -{ - struct defaultobj *obj = objFindByTagId(cmd[2]); - - if (obj && obj->prop && obj->prop->parent && obj->prop->parent->type == PROPTYPE_CHR) { - struct chrdata *chr = obj->prop->parent->chr; - objSetDropped(obj->prop, DROPTYPE_SURRENDER); - chr->hidden |= CHRHFLAG_00000001; - } - - cmd += 3; - - return cmd; -} - /** * @cmd 0068 */ @@ -2446,22 +1963,6 @@ static u8 *aiIfDoorState(u8 *cmd) return cmd; } -/** - * @cmd 006f - */ -static u8 *aiIfObjectIsDoor(u8 *cmd) -{ - struct defaultobj *obj = objFindByTagId(cmd[2]); - - if (obj && obj->prop && obj->type == OBJTYPE_DOOR && (obj->hidden & 0x200)) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 0070 */ @@ -2613,90 +2114,6 @@ static u8 *aiIfNumArghsGreaterThan(u8 *cmd) return cmd; } -/** - * @cmd 007f - */ -static u8 *aiIfNumCloseArghsLessThan(u8 *cmd) -{ - if (chrGetNumCloseArghs(g_Vars.chrdata) < cmd[2]) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - -/** - * @cmd 0080 - */ -static u8 *aiIfNumCloseArghsGreaterThan(u8 *cmd) -{ - if (chrGetNumCloseArghs(g_Vars.chrdata) > cmd[2]) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - -/** - * @cmd 0081 - */ -static u8 *aiIfChrHealthGreaterThan(u8 *cmd) -{ - f32 value = cmd[3] * 0.1f; - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - u32 pass = false; - - if (chr && chr->prop) { - if (chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = playermgrGetPlayerNumByProp(chr->prop); - - pass = (value > g_Vars.players[playernum]->bondhealth * 8.0f); - } else { - pass = (value > chr->maxdamage - chr->damage); - } - } - - if (pass) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - -/** - * @cmd 0082 - */ -static u8 *aiIfChrHealthLessThan(u8 *cmd) -{ - f32 value = cmd[3] * 0.1f; - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - u32 pass = false; - - if (chr && chr->prop) { - if (chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = playermgrGetPlayerNumByProp(chr->prop); - - pass = (value < g_Vars.players[playernum]->bondhealth * 8.0f); - } else { - pass = (value < chr->maxdamage - chr->damage); - } - } - - if (pass) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - /** * @cmd 010f */ @@ -2714,23 +2131,6 @@ static u8 *aiIfChrShieldLessThan(u8 *cmd) return cmd; } -/** - * @cmd 0110 - */ -static u8 *aiIfChrShieldGreaterThan(u8 *cmd) -{ - f32 value = (cmd[4] | (cmd[3] << 8)) * 0.1f; - struct chrdata *chr = chrFindById(g_Vars.chrdata,cmd[2]); - - if (chr && chrGetShield(chr) > value) { - cmd = AILABEL(g_Vars.ailist, cmd[5], cmd[6]); - } else { - cmd = cmd + 7; - } - - return cmd; -} - /** * @cmd 0083 */ @@ -2793,60 +2193,12 @@ static u8 *aiIfDifficultyGreaterThan(u8 *cmd) return cmd; } -/** - * @cmd 0079 - */ -static u8 *aiIfStageTimerLessThan(u8 *cmd) -{ - f32 target = (f32)(cmd[3] | (cmd[2] << 8)); - f32 time = lvGetStageTimeInSeconds(); - - if (time < target) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - -/** - * @cmd 007a - */ -static u8 *aiIfStageTimerGreaterThan(u8 *cmd) -{ - f32 target = (f32)(cmd[3] | (cmd[2] << 8)); - f32 time = lvGetStageTimeInSeconds(); - - if (time > target) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - /** * @cmd 007b */ -static u8 *aiIfStageIdLessThan(u8 *cmd) +static u8 *aiIfStageIsNot(u8 *cmd) { - if (cmd[2] > mainGetStageNum()) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - -/** - * @cmd 007c - */ -static u8 *aiIfStageIdGreaterThan(u8 *cmd) -{ - if (mainGetStageNum() > cmd[2]) { + if (mainGetStageNum() != cmd[2]) { cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); } else { cmd += 5; @@ -2877,18 +2229,6 @@ static u8 *aiAddMorale(u8 *cmd) return cmd; } -/** - * @cmd 0086 - */ -static u8 *aiChrAddMorale(u8 *cmd) -{ - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[3]); - incrementByte(&chr->morale, cmd[2]); - cmd += 4; - - return cmd; -} - /** * @cmd 0087 */ @@ -2914,20 +2254,6 @@ static u8 *aiIfMoraleLessThan(u8 *cmd) return cmd; } -/** - * @cmd 0089 - */ -static u8 *aiIfMoraleLessThanRandom(u8 *cmd) -{ - if (g_Vars.chrdata->morale < g_Vars.chrdata->random) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 008a */ @@ -2966,17 +2292,6 @@ static u8 *aiChrAddAlertness(u8 *cmd) return cmd; } -/** - * @cmd 008d - */ -static u8 *aiSubtractAlertness(u8 *cmd) -{ - decrementByte(&g_Vars.chrdata->alertness, cmd[2]); - cmd += 3; - - return cmd; -} - /** * @cmd 008e */ @@ -3008,20 +2323,6 @@ static u8 *aiIfChrAlertnessLessThan(u8 *cmd) return cmd; } -/** - * @cmd 0090 - */ -static u8 *aiIfAlertnessLessThanRandom(u8 *cmd) -{ - if (g_Vars.chrdata->alertness < g_Vars.chrdata->random) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 0092 */ @@ -3512,23 +2813,6 @@ static u8 *aiUnsetObjFlag(u8 *cmd) return cmd; } -/** - * @cmd 00ac - */ -static u8 *aiIfObjHasFlag(u8 *cmd) -{ - u32 flags = (cmd[4] << 16) | (cmd[5] << 8) | cmd[6] | (cmd[3] << 24); - struct defaultobj *obj = objFindByTagId(cmd[2]); - - if (obj && obj->prop && (obj->flags & flags) == flags) { - cmd = AILABEL(g_Vars.ailist, cmd[7], cmd[8]); - } else { - cmd += 9; - } - - return cmd; -} - /** * @cmd 00ad */ @@ -3671,54 +2955,6 @@ static u8 *aiSetPadPreset(u8 *cmd) return cmd; } -/** - * @cmd 00b3 - */ -static u8 *aiChrSetPadPreset(u8 *cmd) -{ - u16 pad_id = cmd[4] | (cmd[3] << 8); - - chrSetPadPresetByChrnum(g_Vars.chrdata, cmd[2], pad_id); - - cmd += 5; - - return cmd; -} - -/** - * @cmd 00b4 - */ -static u8 *aiChrCopyPadPreset(u8 *cmd) -{ - struct chrdata *chrsrc = chrFindById(g_Vars.chrdata, cmd[2]); - struct chrdata *chrdst = chrFindById(g_Vars.chrdata, cmd[3]); - - chrdst->padpreset1 = chrsrc->padpreset1; - cmd += 4; - - return cmd; -} - -/** - * @cmd 00b5 - * - * The weirdness to do with result is required for a match. - * The original source likely had something similar and probably used ifdefs. - */ -static u8 *aiPrint(u8 *cmd) -{ - return cmd; -} - -/** - * @cmd 0091 - */ -static u8 *aiNoOp0091(u8 *cmd) -{ - cmd += 2; - return cmd; -} - /** * @cmd 00b6 */ @@ -3768,34 +3004,6 @@ static u8 *aiResumeTimer(u8 *cmd) return cmd; } -/** - * @cmd 00ba - */ -static u8 *aiIfTimerStopped(u8 *cmd) -{ - if ((g_Vars.chrdata->hidden & CHRHFLAG_TIMER_RUNNING) == 0) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - -/** - * @cmd 00bb - */ -static u8 *aiIfTimerGreaterThanRandom(u8 *cmd) -{ - if (g_Vars.chrdata->random < g_Vars.chrdata->timer60 * 60) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 00bc */ @@ -3887,20 +3095,6 @@ static u8 *aiStartCountdownTimer(u8 *cmd) return cmd; } -/** - * @cmd 00c3 - */ -static u8 *aiIfCountdownTimerStopped(u8 *cmd) -{ - if (!countdownTimerIsRunning()) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 00c4 */ @@ -4078,28 +3272,6 @@ static u8 *aiTryEquipWeapon(u8 *cmd) return cmd; } -/** - * @cmd 00c9 - */ -static u8 *aiTryEquipHat(u8 *cmd) -{ - u32 flags = (cmd[5] << 16) | (cmd[6] << 8) | cmd[7] | (cmd[4] << 24); - u32 modelnum = cmd[3] | (cmd[2] << 8); - struct prop *prop = NULL; - - if (g_Vars.chrdata && g_Vars.chrdata->prop && g_Vars.chrdata->model) { - prop = hatCreateForChr(g_Vars.chrdata, modelnum, flags); - } - - if (prop) { - cmd = AILABEL(g_Vars.ailist, cmd[8], cmd[9]); - } else { - cmd += 10; - } - - return cmd; -} - /** * @cmd 00ca */ @@ -4363,37 +3535,6 @@ static u8 *aiIfChannelIdle(u8 *cmd) return cmd; } -/** - * @cmd 00d1 - */ -static u8 *ai00d1(u8 *cmd) -{ - s16 audio_id = cmd[4] | (cmd[3] << 8); - u16 thing = cmd[6] | (cmd[5] << 8); - - audioPlayFromProp2((s8)cmd[2], audio_id, -1, NULL, thing, 2500, 3000, 0); - - cmd += 7; - - return cmd; -} - -/** - * @cmd 00d2 - */ -static u8 *ai00d2(u8 *cmd) -{ - f32 thing1 = cmd[4] | (cmd[3] << 8); - u16 thing2 = cmd[6] | (cmd[5] << 8); - s32 audio_id = func0f0927d4(thing1, 400, 2500, 3000, 32767); - - audioPlayFromProp2((s8)cmd[2], audio_id, -1, NULL, thing2, 2500, 3000, 0); - - cmd += 7; - - return cmd; -} - /** * @cmd 00cf */ @@ -4481,22 +3622,6 @@ static u8 *ai00d0(u8 *cmd) return cmd; } -/** - * @cmd 00d4 - */ -static u8 *ai00d4(u8 *cmd) -{ - s16 thing = cmd[4] | (cmd[3] << 8); - - if (channelGetUnk06((s8)cmd[2]) < thing) { - cmd = AILABEL(g_Vars.ailist, cmd[5], cmd[6]); - } else { - cmd += 7; - } - - return cmd; -} - /** * @cmd 00d5 */ @@ -4590,24 +3715,6 @@ static u8 *aiSetRotorSpeed(u8 *cmd) return cmd; } -/** - * @cmd 00d8 - */ -static u8 *aiNoOp00d8(u8 *cmd) -{ - cmd += 3; - return cmd; -} - -/** - * @cmd 00d9 - */ -static u8 *aiNoOp00d9(u8 *cmd) -{ - cmd += 3; - return cmd; -} - /** * @cmd 00da */ @@ -4633,15 +3740,6 @@ static u8 *aiSetObjImage(u8 *cmd) return cmd; } -/** - * @cmd 00db - */ -static u8 *aiNoOp00db(u8 *cmd) -{ - cmd += 3; - return cmd; -} - /** * @cmd 00dc */ @@ -4685,15 +3783,6 @@ static u8 *aiWarpJoToPad(u8 *cmd) return cmd; } -/** - * @cmd 010d - */ -static u8 *aiNoOp010d(u8 *cmd) -{ - cmd += 2; - return cmd; -} - /** * @cmd 0111 */ @@ -4916,27 +4005,6 @@ static u8 *aiDisableObj(u8 *cmd) return cmd; } -/** - * @cmd 00df - */ -static u8 *ai00df(u8 *cmd) -{ - struct tag *tag = tagFindById(cmd[2]); - - if (tag) { - s32 cmdindex = setupGetCmdIndexByTag(tag); - - if (cmdindex >= 0) { - struct warpparams *params = (struct warpparams *) setupGetCmdByIndex(cmdindex + tag->cmdoffset); - playerPrepareWarpType2(params, cmd[4] | (cmd[3] << 8), cmd[6] | (cmd[5] << 8)); - } - } - - cmd += 7; - - return cmd; -} - /** * @cmd 00e0 */ @@ -5038,79 +4106,6 @@ static u8 *aiChrMoveToPad(u8 *cmd) return cmd; } -/** - * @cmd 00e3 - */ -static u8 *ai00e3(u8 *cmd) -{ - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - - if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = playermgrGetPlayerNumByProp(chr->prop); - setCurrentPlayerNum(playernum); - - if (var8007074c != 2) { - playerSetFadeColour(0, 0, 0, 0); - playerSetFadeFrac(60, 1); - } - - setCurrentPlayerNum(prevplayernum); - } - - cmd += 3; - - return cmd; -} - -/** - * @cmd 00e4 - */ -static u8 *ai00e4(u8 *cmd) -{ - s32 playernum; - u32 prevplayernum = g_Vars.currentplayernum; - - for (playernum = 0; playernum < PLAYERCOUNT(); playernum++) { - setCurrentPlayerNum(playernum); - - if (var8007074c != 2) { - playerSetFadeColour(0, 0, 0, 1); - playerSetFadeFrac(60, 0); - } - } - - setCurrentPlayerNum(prevplayernum); - cmd += 3; - - return cmd; -} - -/** - * @cmd 00e5 - */ -static u8 *aiIfColourFadeComplete(u8 *cmd) -{ - bool pass = false; - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - - if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - u32 playernum = playermgrGetPlayerNumByProp(chr->prop); - - if (g_Vars.players[playernum]->colourfadetimemax60 < 0) { - pass = true; - } - } - - if (pass) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 00e8 */ @@ -5134,22 +4129,6 @@ static u8 *aiSetDoorOpen(u8 *cmd) return cmd; } -/** - * @cmd 00e9 - */ -static u8 *ai00e9(u8 *cmd) -{ - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - - if (chr) { - weaponDeleteFromChr(chr, cmd[3]); - } - - cmd += 4; - - return cmd; -} - /** * @cmd 00ea */ @@ -5234,30 +4213,6 @@ static u8 *aiChrDrawWeaponInCutscene(u8 *cmd) return cmd; } -/** - * @cmd 00ee - */ -static u8 *ai00ee(u8 *cmd) -{ - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - - if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = playermgrGetPlayerNumByProp(chr->prop); - setCurrentPlayerNum(playernum); - - g_Vars.currentplayer->bondforcespeed.x = (s8)cmd[3]; - g_Vars.currentplayer->bondforcespeed.y = 0; - g_Vars.currentplayer->bondforcespeed.z = (s8)cmd[4]; - - setCurrentPlayerNum(prevplayernum); - } - - cmd += 5; - - return cmd; -} - /** * @cmd 00ef */ @@ -5276,17 +4231,6 @@ static u8 *aiIfObjInRoom(u8 *cmd) return cmd; } -/** - * @cmd 00f2 - */ -static u8 *aiSwitchToAltSky(u8 *cmd) -{ - envApplyTransitionFrac(1); - cmd += 2; - - return cmd; -} - /** * @cmd 00f3 */ @@ -5307,50 +4251,6 @@ static u8 *aiChrSetInvincible(u8 *cmd) return cmd; } -/** - * @cmd 00f4 - */ -static u8 *ai00f4(u8 *cmd) -{ - s32 range = cmd[3] | (cmd[2] << 8); - s16 height1 = cmd[5] | (cmd[4] << 8); - s16 rotangle = cmd[7] | (cmd[6] << 8); - s32 padnum = cmd[9] | (cmd[8] << 8); - s16 height2 = cmd[11] | (cmd[10] << 8); - s32 posangle = cmd[13] | (cmd[12] << 8); - - playerPrepareWarpType3(posangle * M_BADTAU / 65536, rotangle * M_BADTAU / 65536, range, height1, height2, padnum); - - cmd += 14; - - return cmd; -} - -/** - * @cmd 00f5 - */ -static u8 *ai00f5(u8 *cmd) -{ - var8007073c = 1; - cmd += 2; - - return cmd; -} - -/** - * @cmd 00f6 - */ -static u8 *ai00f6(u8 *cmd) -{ - if (var8007073c == 2) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 00f7 */ @@ -5365,31 +4265,6 @@ static u8 *aiIfAllObjectivesComplete(u8 *cmd) return cmd; } -/** - * @cmd 00f8 - */ -static u8 *aiIfPlayerIsInvincible(u8 *cmd) -{ - bool pass = false; - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - - if (chr && chr->prop && chr->prop->type == PROPTYPE_PLAYER) { - u32 prevplayernum = g_Vars.currentplayernum; - u32 playernum = playermgrGetPlayerNumByProp(chr->prop); - setCurrentPlayerNum(playernum); - pass = g_PlayerInvincible; - setCurrentPlayerNum(prevplayernum); - } - - if (pass) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 00f9 */ @@ -5535,63 +4410,6 @@ static u8 *aiIfNumKnockedOutChrs(u8 *cmd) return cmd; } -/** - * @cmd 00fd - */ -static u8 *ai00fd(u8 *cmd) -{ - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - - if (chr && (chr->chrflags & CHRCFLAG_TRIGGERSHOTLIST)) { - chr->chrflags &= ~CHRCFLAG_TRIGGERSHOTLIST; - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - -/** - * @cmd 00fe - */ -static u8 *aiKillBond(u8 *cmd) -{ - g_Vars.bond->isdead = true; - cmd += 2; - - return cmd; -} - -/** - * @cmd 00ff - */ -static u8 *aiBeSurprisedSurrender(u8 *cmd) -{ - chrTrySurprisedSurrender(g_Vars.chrdata); - cmd += 2; - - return cmd; -} - -/** - * @cmd 0100 - */ -static u8 *aiNoOp0100(u8 *cmd) -{ - cmd += 3; - return cmd; -} - -/** - * @cmd 0101 - */ -static u8 *aiNoOp0101(u8 *cmd) -{ - cmd += 3; - return cmd; -} - /** * @cmd 0102 */ @@ -5618,58 +4436,6 @@ static u8 *aiSetLights(u8 *cmd) return cmd; } -/** - * @cmd 0103 - */ -static u8 *aiIfPropPresetIsBlockingSightToTarget(u8 *cmd) -{ - if (chrIsPropPresetBlockingSightToTarget(g_Vars.chrdata)) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - -/** - * @cmd 0104 - */ -static u8 *aiRemoveObjectAtPropPreset(u8 *cmd) -{ - if (g_Vars.chrdata->proppreset1 >= 0) { - struct defaultobj *obj = (g_Vars.props + g_Vars.chrdata->proppreset1)->obj; - obj->hidden &= ~OBJHFLAG_OCCUPIEDCHAIR; - } - - g_Vars.chrdata->proppreset1 = -1; - cmd += 2; - - return cmd; -} - -/** - * @cmd 0105 - */ -static u8 *aiIfPropPresetHeightLessThan(u8 *cmd) -{ - struct prop *prop = &g_Vars.props[g_Vars.chrdata->proppreset1]; - f32 value = cmd[3] | (cmd[2] << 8); - f32 ymax; - f32 ymin; - f32 radius; - - propGetBbox(prop, &radius, &ymax, &ymin); - - if (ymax - ymin < value) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - /** * @cmd 0106 */ @@ -5755,39 +4521,6 @@ static u8 *aiIfChrTarget(u8 *cmd) return cmd; } -/** - * @cmd 0109 - */ -static u8 *aiSetChrPresetToChrNearSelf(u8 *cmd) -{ - f32 distance = (cmd[4] | (cmd[3] << 8)) * 10.0f; - - if (chrSetChrPresetToChrNearSelf(cmd[2], g_Vars.chrdata, distance)) { - cmd = AILABEL(g_Vars.ailist, cmd[5], cmd[6]); - } else { - cmd += 7; - } - - return cmd; -} - -/** - * @cmd 010a - */ -static u8 *aiSetChrPresetToChrNearPad(u8 *cmd) -{ - f32 distance = (cmd[4] | (cmd[3] << 8)) * 10.0f; - u16 padnum = cmd[6] | (cmd[5] << 8); - - if (chrSetChrPresetToChrNearPad(cmd[2], g_Vars.chrdata, distance, padnum)) { - cmd = AILABEL(g_Vars.ailist, cmd[7], cmd[8]); - } else { - cmd += 9; - } - - return cmd; -} - /** * @cmd 010b */ @@ -5804,43 +4537,6 @@ static u8 *aiChrSetTeam(u8 *cmd) return cmd; } -/** - * @cmd 010c - */ -static u8 *aiIfCompareChrPresetsTeam(u8 *cmd) -{ - struct chrdata *chr = chrFindById(g_Vars.chrdata, CHR_PRESET); - - if (!chr || (!chr->model && chr->prop->type != PROPTYPE_PLAYER)) { - chrSetChrPreset(g_Vars.chrdata, CHR_BOND); - chr = chrFindById(g_Vars.chrdata, CHR_PRESET); - } - - if (chrCompareTeams(chr, g_Vars.chrdata, cmd[2])) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - -/** - * @cmd 011e - */ -static u8 *aiIfHuman(u8 *cmd) -{ - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - - if (chr && chr->prop && CHRRACE(chr) == RACE_HUMAN) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 011f */ @@ -5960,40 +4656,6 @@ static u8 *aiFindCover(u8 *cmd) return cmd; } -/** - * @cmd 0122 - */ -static u8 *aiFindCoverWithinDist(u8 *cmd) -{ - u16 criteria = cmd[3] | (cmd[2] << 8); - u32 flags = (cmd[5] << 16) | (cmd[6] << 8) | cmd[7] | (cmd[4] << 24); - - if (g_Vars.chrdata && g_Vars.chrdata->prop && chrAssignCoverByCriteria(g_Vars.chrdata, criteria, flags) != -1) { - cmd = AILABEL(g_Vars.ailist, cmd[8], cmd[9]); - } else { - cmd += 10; - } - - return cmd; -} - -/** - * @cmd 0123 - */ -static u8 *aiFindCoverOutsideDist(u8 *cmd) -{ - u16 criteria = cmd[3] | (cmd[2] << 8); - u32 flags = (cmd[5] << 16) | (cmd[6] << 8) | cmd[7] | (cmd[4] << 24); - - if (g_Vars.chrdata && g_Vars.chrdata->prop && chrAssignCoverByCriteria(g_Vars.chrdata, criteria, -flags) != -1) { - cmd = AILABEL(g_Vars.ailist, cmd[8], cmd[9]); - } else { - cmd += 10; - } - - return cmd; -} - /** * @cmd 0124 */ @@ -6211,48 +4873,6 @@ static u8 *aiDetectEnemy(u8 *cmd) return cmd; } -/** - * @cmd 0129 - */ -static u8 *aiIfSafetyLessThan(u8 *cmd) -{ - s16 *chrnums = teamGetChrIds(g_Vars.chrdata->team); - u8 safety = 6; - u8 numnearby = 0; - - if (chrGetNumArghs(g_Vars.chrdata) > 0) { - safety--; - } - - while (*chrnums != -2) { - struct chrdata *chr = chrFindByLiteralId(*chrnums); - - if (chr && chr->model - && !chrIsDead(chr) - && chr->actiontype != ACT_DEAD - && g_Vars.chrdata->chrnum != chr->chrnum - && chrGetDistanceToChr(g_Vars.chrdata, chr->chrnum) < 3500) { - numnearby++; - } - - chrnums++; - } - - if (numnearby == 0) { - safety -= 2; - } else if (numnearby < 3) { - safety--; - } - - if (safety < cmd[2]) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 012a */ @@ -7241,20 +5861,6 @@ static u8 *aiSetSquadron(u8 *cmd) return cmd; } -/** - * @cmd 013c - */ -static u8 *aiFaceCover(u8 *cmd) -{ - if (chrFaceCover(g_Vars.chrdata)) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 013d */ @@ -7283,24 +5889,6 @@ static u8 *ai013e(u8 *cmd) return cmd; } -/** - * @cmd 013f - */ -static u8 *aiIfHeliWeaponsArmed(u8 *cmd) -{ - if (g_Vars.hovercar) { - if (g_Vars.hovercar->weaponsarmed) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 0140 */ @@ -7465,36 +6053,12 @@ static u8 *aiHeliArmWeapons(u8 *cmd) return cmd; } -/** - * @cmd 0144 - */ -static u8 *aiHeliUnarmWeapons(u8 *cmd) -{ - if (g_Vars.hovercar) { - chopperSetArmed(g_Vars.hovercar, false); - } - - cmd += 2; - - return cmd; -} - /** * @cmd 0145 */ static u8 *aiRebuildTeams(u8 *cmd) { rebuildTeams(); - cmd += 2; - - return cmd; -} - -/** - * @cmd 0146 - */ -static u8 *aiRebuildSquadrons(u8 *cmd) -{ rebuildSquadrons(); cmd += 2; @@ -7539,71 +6103,6 @@ static u8 *aiIfSquadronIsDead(u8 *cmd) return cmd; } -/** - * @cmd 0148 - */ -static u8 *aiChrSetListening(u8 *cmd) -{ - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd[2]); - - if (chr && chr->listening == 0) { - chr->listening = cmd[3]; - } - - cmd += 4; - - return cmd; -} - -/** - * @cmd 0149 - */ -static u8 *aiIfChrListening(u8 *cmd) -{ - struct bytelist *cmd2 = (struct bytelist *)(cmd); - struct chrdata *chr = chrFindById(g_Vars.chrdata, cmd2->b2); - - if (cmd2->b4 == 0) { - if (chr->listening == cmd2->b3) { - cmd = AILABEL(g_Vars.ailist, cmd2->b5, cmd2->b6); - } else { - cmd += 7; - } - } else { - if (g_Vars.chrdata->convtalk == 0) { - cmd = AILABEL(g_Vars.ailist, cmd2->b5, cmd2->b6); - } else { - cmd += 7; - } - } - - return cmd; -} - -/** - * @cmd 014a - */ -static u8 *aiIfTrue(u8 *cmd) -{ - cmd = AILABEL(g_Vars.ailist, cmd[5], cmd[6]); - - return cmd; -} - -/** - * @cmd 014b - */ -static u8 *aiIfNotListening(u8 *cmd) -{ - if (g_Vars.chrdata->listening == 0) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 0157 */ @@ -7665,22 +6164,6 @@ static u8 *aiIfChrInjured(u8 *cmd) return cmd; } -/** - * @cmd 0166 - */ -static u8 *aiIfAction(u8 *cmd) -{ - struct bytelist *cmd2 = (struct bytelist *)(cmd); - - if (g_Vars.chrdata->myaction == cmd2->b2) { - cmd = AILABEL(g_Vars.ailist, cmd2->b3, cmd2->b4); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 0167 */ @@ -7741,15 +6224,6 @@ static u8 *aiIfY(u8 *cmd) return cmd; } -/** - * @cmd 016c - */ -static u8 *aiNoOp016c(u8 *cmd) -{ - cmd += 2; - return cmd; -} - /** * @cmd 016d */ @@ -8101,49 +6575,6 @@ static u8 *aiIfLiftStationary(u8 *cmd) return cmd; } -/** - * @cmd 0189 - */ -static u8 *aiLiftGoToStop(u8 *cmd) -{ - struct defaultobj *obj = objFindByTagId(cmd[2]); - - if (obj && obj->prop && obj->type == OBJTYPE_LIFT) { - struct liftobj *lift = (struct liftobj *)obj; - liftGoToStop(lift, cmd[3]); - } - - cmd += 4; - - return cmd; -} - -/** - * @cmd 018a - */ -static u8 *aiIfLiftAtStop(u8 *cmd) -{ - struct bytelist *cmd2 = (struct bytelist *)(cmd); - struct defaultobj *obj = objFindByTagId(cmd2->b2); - bool pass = false; - - if (obj && obj->prop && obj->type == OBJTYPE_LIFT) { - struct liftobj *lift = (struct liftobj *)obj; - - if (lift->levelcur == cmd2->b3 && lift->dist == 0) { - pass = true; - } - } - - if (pass) { - cmd = AILABEL(g_Vars.ailist, cmd2->b4, cmd2->b5); - } else { - cmd += 6; - } - - return cmd; -} - /** * @cmd 018b */ @@ -8506,64 +6937,6 @@ static u8 *aiDoPresetAnimation(u8 *cmd) return cmd; } -/** - * @cmd 01a5 - */ -static u8 *aiIfUsingLift(u8 *cmd) -{ - if (chrIsUsingLift(g_Vars.chrdata)) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - -/** - * @cmd 01a6 - */ -static u8 *aiIfTargetYDifferenceLessThan(u8 *cmd) -{ - struct prop *prop = chrGetTargetProp(g_Vars.chrdata); - f32 diff = prop->pos.y - g_Vars.chrdata->prop->pos.y; - - if (diff < 0) { - diff = 0 - diff; - } - - if (diff < (s32)cmd[2] * 10.0f) { - cmd = AILABEL(g_Vars.ailist, cmd[3], cmd[4]); - } else { - cmd += 5; - } - - return cmd; -} - -/** - * @cmd 01aa - */ -static u8 *ai01aa(u8 *cmd) -{ - f32 a = 3000; - - func0f0056f4( - g_Vars.currentplayer->prop->rooms[0], - &g_Vars.currentplayer->prop->pos, - g_Vars.chrdata->prop->rooms[0], - &g_Vars.chrdata->prop->pos, - 0, &a, 0); - - if (a < 3000) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 01ae */ @@ -8731,33 +7104,6 @@ static u8 *aiToggleP1P2(u8 *cmd) return cmd; } -/** - * @cmd 01b5 - */ -static u8 *aiChrSetP1P2(u8 *cmd) -{ - if (g_Vars.coopplayernum >= 0) { - struct chrdata *chr1 = chrFindById(g_Vars.chrdata, cmd[2]); - struct chrdata *chr2 = chrFindById(g_Vars.chrdata, cmd[3]); - - if (chr1 && chr2 && chr2->prop && chr2->prop->type == PROPTYPE_PLAYER) { - u32 playernum = playermgrGetPlayerNumByProp(chr2->prop); - - if (!g_Vars.players[playernum]->isdead) { - if (chr2->prop == g_Vars.coop->prop) { - chr1->p1p2 = g_Vars.coopplayernum; - } else { - chr1->p1p2 = g_Vars.bondplayernum; - } - } - } - } - - cmd += 4; - - return cmd; -} - /** * @cmd 01b7 */ @@ -8836,31 +7182,6 @@ static u8 *aiShufflePelagicSwitches(u8 *cmd) return cmd; } -/** - * @cmd 01bb - */ -static u8 *aiNoOp01bb(u8 *cmd) -{ - cmd += 4; - return cmd; -} - -/** - * @cmd 01bc - */ -static u8 *ai01bc(u8 *cmd) -{ - struct bytelist *cmd2 = (struct bytelist *)(cmd); - - if (g_Vars.chrdata->pouncebits == cmd2->b2) { - cmd = AILABEL(g_Vars.ailist, cmd2->b3, cmd2->b4); - } else { - cmd += 5; - } - - return cmd; -} - /** * @cmd 01bd */ @@ -9017,43 +7338,6 @@ static u8 *aiIfChrTeleportFullWhite(u8 *cmd) return cmd; } -/** - * @cmd 01c5 - */ -static u8 *aiAvoid(u8 *cmd) -{ - chrAvoid(g_Vars.chrdata); - cmd += 2; - - return cmd; -} - -/** - * @cmd 01c8 - */ -static u8 *aiTitleInitMode(u8 *cmd) -{ - titleInitFromAiCmd(cmd[2]); - cmd += 3; - - return cmd; -} - -/** - * @cmd 01c9 - */ -static u8 *aiTryExitTitle(u8 *cmd) -{ - if (titleIsChangingMode()) { - titleExit(); - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd = cmd + 4; - } - - return cmd; -} - /** * @cmd 01ca */ @@ -9125,20 +7409,6 @@ static u8 *aiFadeScreen(u8 *cmd) return cmd; } -/** - * @cmd 01cc - */ -static u8 *aiIfFadeComplete(u8 *cmd) -{ - if (lvIsFadeActive() == false) { - cmd = AILABEL(g_Vars.ailist, cmd[2], cmd[3]); - } else { - cmd += 4; - } - - return cmd; -} - /** * @cmd 01cd */ @@ -9390,38 +7660,6 @@ static u8 *aiConfigureEnvironment(u8 *cmd) return cmd; } -/** - * @cmd 01d7 - */ -static u8 *aiIfDistanceToTarget2LessThan(u8 *cmd) -{ - f32 distance = (cmd[3] | (cmd[2] << 8)) * 10.0f; - - if (chrGetDistanceToTarget2(g_Vars.chrdata) < distance) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - -/** - * @cmd 01d8 - */ -static u8 *aiIfDistanceToTarget2GreaterThan(u8 *cmd) -{ - f32 distance = (cmd[3] | (cmd[2] << 8)) * 10.0f; - - if (chrGetDistanceToTarget2(g_Vars.chrdata) > distance) { - cmd = AILABEL(g_Vars.ailist, cmd[4], cmd[5]); - } else { - cmd += 6; - } - - return cmd; -} - /** * @cmd 01d9 */ @@ -9584,10 +7822,102 @@ static u8 *ai0176(u8 *cmd) return cmd; } +static u8 *aiSubCommand(u8 *cmd) +{ + switch (cmd[1]) { + case 0x00: return aiIfCutsceneButtonPressed(cmd); + case 0x01: return aiIfPlayerAutoWalkFinished(cmd); + case 0x02: return aiIfSavefileFlagIsSet(cmd); + case 0x03: return aiIfSavefileFlagIsUnset(cmd); + case 0x04: return aiIfTrainingPcHolographed(cmd); + case 0x05: return aiIfChrTeleportFullWhite(cmd); + case 0x06: return aiIfMusicEventQueueIsEmpty(cmd); + case 0x07: return aiSetPath(cmd); + case 0x08: return aiStartPatrol(cmd); + case 0x09: return aiSurrender(cmd); + case 0x0a: return aiLockDoor(cmd); + case 0x0b: return aiSetGrenadeProbability(cmd); + case 0x0c: return aiSetChrNum(cmd); + case 0x0d: return aiSetMaxDamage(cmd); + case 0x0e: return aiAddHealth(cmd); + case 0x0f: return aiSetReactionSpeed(cmd); + case 0x10: return aiSetRecoverySpeed(cmd); + case 0x11: return aiSetAccuracy(cmd); + case 0x12: return aiShowCountdownTimer(cmd); + case 0x13: return aiHideCountdownTimer(cmd); + case 0x14: return aiSetCountdownTimerValue(cmd); + case 0x15: return aiStopCountdownTimer(cmd); + case 0x16: return aiStartCountdownTimer(cmd); + case 0x17: return ai00d0(cmd); + case 0x18: return aiHovercarBeginPath(cmd); + case 0x19: return aiSetVehicleSpeed(cmd); + case 0x1a: return aiSetRotorSpeed(cmd); + case 0x1b: return aiEndLevel(cmd); + case 0x1c: return ai00dd(cmd); + case 0x1d: return aiWarpJoToPad(cmd); + case 0x1e: return aiRevokeControl(cmd); + case 0x1f: return aiGrantControl(cmd); + case 0x20: return aiChrDrawWeaponInCutscene(cmd); + case 0x21: return aiChrSetInvincible(cmd); + case 0x22: return aiPlayXTrack(cmd); + case 0x23: return aiStopXTrack(cmd); + case 0x24: return aiChrExplosions(cmd); + case 0x25: return aiSetLights(cmd); + case 0x26: return aiChrSetTeam(cmd); + case 0x27: return aiSetShield(cmd); + case 0x28: return aiSetCameraAnimation(cmd); + case 0x29: return aiSetSquadron(cmd); + case 0x2a: return aiShuffleInvestigationTerminals(cmd); + case 0x2b: return aiSetPadPresetToInvestigationTerminal(cmd); + case 0x2c: return aiHeliArmWeapons(cmd); + case 0x2d: return aiSetTintedGlassEnabled(cmd); + case 0x2e: return aiPlayTrackIsolated(cmd); + case 0x2f: return aiPlayDefaultTracks(cmd); + case 0x30: return ai016b(cmd); + case 0x31: return aiChrAdjustMotionBlur(cmd); + case 0x32: return aiPlayerAutoWalk(cmd); + case 0x33: return aiPlayCutsceneTrack(cmd); + case 0x34: return aiStopCutsceneTrack(cmd); + case 0x35: return aiPlayTemporaryTrack(cmd); + case 0x36: return aiStopAmbientTrack(cmd); + case 0x37: return aiMpInitSimulants(cmd); + case 0x38: return aiConfigureRain(cmd); + case 0x39: return aiChrToggleModelPart(cmd); + case 0x3a: return aiActivateLift(cmd); + case 0x3b: return aiSetSavefileFlag(cmd); + case 0x3c: return aiUnsetSavefileFlag(cmd); + case 0x3d: return aiSayCiStaffQuip(cmd); + case 0x3e: return aiReleaseObject(cmd); + case 0x3f: return aiClearInventory(cmd); + case 0x40: return aiChrGrabObject(cmd); + case 0x41: return aiShuffleRuinsPillars(cmd); + case 0x42: return aiSetWindSpeed(cmd); + case 0x43: return aiConfigureSnow(cmd); + case 0x44: return aiShufflePelagicSwitches(cmd); + case 0x45: return aiChrBeginOrEndTeleport(cmd); + case 0x46: return aiSetDodgeRating(cmd); + case 0x47: return aiSetUnarmedDodgeRating(cmd); + case 0x48: return aiChrSetCutsceneWeapon(cmd); + case 0x49: return aiSetChrHudpieceVisible(cmd); + case 0x4a: return aiSetPassiveMode(cmd); + case 0x4b: return aiChrSetFiringInCutscene(cmd); + case 0x4c: return aiSetPortalFlag(cmd); + case 0x4d: return aiObjSetModelPartVisible(cmd); + case 0x4e: return aiSetDrCarollImages(cmd); + case 0x4f: return aiSetRoomFlag(cmd); + case 0x50: return aiShowCutsceneChrs(cmd); + case 0x51: return aiConfigureEnvironment(cmd); + case 0x52: return aiPlaySoundFromProp(cmd); + case 0x53: return aiPlayTemporaryPrimaryTrack(cmd); + case 0x54: return aiRemoveWeaponFromInventory(cmd); + case 0x55: return aiRemoveReferencesToChr(cmd); + } + + while (1); +} + void chraiExecute(void *entity, s32 proptype) { - static u8 *(*g_CommandPointers[])(u8 *cmd) = { - }; u8 *cmd = NULL; g_Vars.chrdata = NULL; @@ -9699,490 +8029,263 @@ void chraiExecute(void *entity, s32 proptype) // Iterate and execute the ailist do { - s32 type = (cmd[0] << 8) | cmd[1]; - - switch (type) { - case 0x0000: cmd = aiGoToNext(cmd); break; - case 0x0001: cmd = aiGoToFirst(cmd); break; - case 0x0002: cmd = aiLabel(cmd); break; - case 0x0003: cmd = aiYield(cmd); break; - case 0x0004: cmd = aiEndList(cmd); break; - case 0x0005: cmd = aiSetList(cmd); break; - case 0x0006: cmd = aiSetReturnList(cmd); break; - case 0x0007: cmd = aiSetShotList(cmd); break; - case 0x0008: cmd = aiReturn(cmd); break; - case 0x0009: cmd = aiStop(cmd); break; - case 0x000a: cmd = aiKneel(cmd); break; - case 0x000b: cmd = aiChrDoAnimation(cmd); break; - case 0x000c: cmd = aiIfIdle(cmd); break; - case 0x000d: cmd = aiBeSurprisedOneHand(cmd); break; - case 0x000e: cmd = aiBeSurprisedLookAround(cmd); break; - case 0x000f: cmd = aiTrySidestep(cmd); break; - case 0x0010: cmd = aiTryJumpOut(cmd); break; - case 0x0011: cmd = aiTryRunSideways(cmd); break; - case 0x0012: cmd = aiTryAttackWalk(cmd); break; - case 0x0013: cmd = aiTryAttackRun(cmd); break; - case 0x0014: cmd = aiTryAttackRoll(cmd); break; - case 0x0015: cmd = aiTryAttackStand(cmd); break; - case 0x0016: cmd = aiTryAttackKneel(cmd); break; - case 0x0017: cmd = aiTryModifyAttack(cmd); break; - case 0x0018: cmd = aiFaceEntity(cmd); break; - case 0x0019: cmd = ai0019(cmd); break; - case 0x001a: cmd = aiChrDamageChr(cmd); break; - case 0x001b: cmd = aiConsiderGrenadeThrow(cmd); break; - case 0x001c: cmd = aiDropItem(cmd); break; - case 0x001d: cmd = aiJogToPad(cmd); break; - case 0x001e: cmd = aiGoToPadPreset(cmd); break; - case 0x001f: cmd = aiWalkToPad(cmd); break; - case 0x0020: cmd = aiRunToPad(cmd); break; - case 0x0021: cmd = aiSetPath(cmd); break; - case 0x0022: cmd = aiStartPatrol(cmd); break; - case 0x0023: cmd = aiIfPatrolling(cmd); break; - case 0x0024: cmd = aiSurrender(cmd); break; - case 0x0025: cmd = aiFadeOut(cmd); break; - case 0x0026: cmd = aiRemoveChr(cmd); break; - case 0x0027: cmd = aiTryStartAlarm(cmd); break; - case 0x0028: cmd = aiActivateAlarm(cmd); break; - case 0x0029: cmd = aiDeactivateAlarm(cmd); break; - case 0x002a: cmd = aiTryRunFromTarget(cmd); break; - case 0x002b: cmd = aiTryJogToTargetProp(cmd); break; - case 0x002c: cmd = aiTryWalkToTargetProp(cmd); break; - case 0x002d: cmd = aiTryRunToTargetProp(cmd); break; - case 0x002e: cmd = aiTryGoToCoverProp(cmd); break; - case 0x002f: cmd = aiTryJogToChr(cmd); break; - case 0x0030: cmd = aiTryWalkToChr(cmd); break; - case 0x0031: cmd = aiTryRunToChr(cmd); break; - case 0x0032: cmd = aiIfStopped(cmd); break; - case 0x0033: cmd = aiIfChrDead(cmd); break; - case 0x0034: cmd = aiIfChrDeathAnimationFinished(cmd); break; - case 0x0035: cmd = aiIfTargetInSight(cmd); break; - case 0x0036: cmd = aiRandom(cmd); break; - case 0x0037: cmd = aiIfRandomLessThan(cmd); break; - case 0x0038: cmd = aiIfRandomGreaterThan(cmd); break; - case 0x0039: cmd = aiIfCanHearAlarm(cmd); break; - case 0x003a: cmd = aiIfAlarmActive(cmd); break; - case 0x003b: cmd = aiIfGasActive(cmd); break; - case 0x003c: cmd = aiIfHearsTarget(cmd); break; - case 0x003d: cmd = aiIfSawInjury(cmd); break; - case 0x003e: cmd = aiIfSawDeath(cmd); break; - case 0x003f: cmd = aiIfCanSeeTarget(cmd); break; - case 0x0040: cmd = aiIfTargetNearlyInSight(cmd); break; - case 0x0041: cmd = aiIfNearlyInTargetsSight(cmd); break; - case 0x0042: cmd = aiSetPadPresetToPadOnRouteToTarget(cmd); break; - case 0x0043: cmd = aiIfSawTargetRecently(cmd); break; - case 0x0044: cmd = aiIfHeardTargetRecently(cmd); break; - case 0x0045: cmd = ai0045(cmd); break; - case 0x0046: cmd = aiIfNeverBeenOnScreen(cmd); break; - case 0x0047: cmd = aiIfOnScreen(cmd); break; - case 0x0048: cmd = aiIfChrInOnScreenRoom(cmd); break; - case 0x0049: cmd = aiIfRoomIsOnScreen(cmd); break; - case 0x004a: cmd = ai004a(cmd); break; - case 0x004b: cmd = aiIfNearMiss(cmd); break; - case 0x004c: cmd = aiIfSeesSuspiciousItem(cmd); break; - case 0x004d: cmd = aiIfTargetInFovLeft(cmd); break; - case 0x004e: cmd = aiIfCheckFovWithTarget(cmd); break; - case 0x004f: cmd = aiIfTargetOutOfFovLeft(cmd); break; - case 0x0050: cmd = aiIfTargetInFov(cmd); break; - case 0x0051: cmd = aiIfTargetOutOfFov(cmd); break; - case 0x0052: cmd = aiIfDistanceToTargetLessThan(cmd); break; - case 0x0053: cmd = aiIfDistanceToTargetGreaterThan(cmd); break; - case 0x0054: cmd = aiIfChrDistanceToPadLessThan(cmd); break; - case 0x0055: cmd = aiIfChrDistanceToPadGreaterThan(cmd); break; - case 0x0056: cmd = aiIfDistanceToChrLessThan(cmd); break; - case 0x0057: cmd = aiIfDistanceToChrGreaterThan(cmd); break; - case 0x0058: cmd = ai0058(cmd); break; - case 0x0059: cmd = aiIfDistanceFromTargetToPadLessThan(cmd); break; - case 0x005a: cmd = aiIfDistanceFromTargetToPadGreaterThan(cmd); break; - case 0x005b: cmd = aiIfChrInRoom(cmd); break; - case 0x005c: cmd = aiIfTargetInRoom(cmd); break; - case 0x005d: cmd = aiIfChrHasObject(cmd); break; - case 0x005e: cmd = aiIfWeaponThrown(cmd); break; - case 0x005f: cmd = aiIfWeaponThrownOnObject(cmd); break; - case 0x0060: cmd = aiIfChrHasWeaponEquipped(cmd); break; - case 0x0061: cmd = aiIfGunUnclaimed(cmd); break; - case 0x0062: cmd = aiIfObjectHealthy(cmd); break; - case 0x0063: cmd = aiIfChrActivatedObject(cmd); break; - case 0x0064: break; - case 0x0065: cmd = aiObjInteract(cmd); break; - case 0x0066: cmd = aiDestroyObject(cmd); break; - case 0x0067: cmd = ai0067(cmd); break; - case 0x0068: cmd = aiChrDropItems(cmd); break; - case 0x0069: cmd = aiChrDropWeapon(cmd); break; - case 0x006a: cmd = aiGiveObjectToChr(cmd); break; - case 0x006b: cmd = aiObjectMoveToPad(cmd); break; - case 0x006c: cmd = aiOpenDoor(cmd); break; - case 0x006d: cmd = aiCloseDoor(cmd); break; - case 0x006e: cmd = aiIfDoorState(cmd); break; - case 0x006f: cmd = aiIfObjectIsDoor(cmd); break; - case 0x0070: cmd = aiLockDoor(cmd); break; - case 0x0071: cmd = aiUnlockDoor(cmd); break; - case 0x0072: cmd = aiIfDoorLocked(cmd); break; - case 0x0073: cmd = aiIfObjectiveComplete(cmd); break; - case 0x0074: cmd = aiIfObjectiveFailed(cmd); break; - case 0x0075: cmd = ai0075(cmd); break; - case 0x0076: cmd = aiSetPadPresetToTargetQuadrant(cmd); break; - case 0x0077: cmd = aiIfDifficultyLessThan(cmd); break; - case 0x0078: cmd = aiIfDifficultyGreaterThan(cmd); break; - case 0x0079: cmd = aiIfStageTimerLessThan(cmd); break; - case 0x007a: cmd = aiIfStageTimerGreaterThan(cmd); break; - case 0x007b: cmd = aiIfStageIdLessThan(cmd); break; - case 0x007c: cmd = aiIfStageIdGreaterThan(cmd); break; - case 0x007d: cmd = aiIfNumArghsLessThan(cmd); break; - case 0x007e: cmd = aiIfNumArghsGreaterThan(cmd); break; - case 0x007f: cmd = aiIfNumCloseArghsLessThan(cmd); break; - case 0x0080: cmd = aiIfNumCloseArghsGreaterThan(cmd); break; - case 0x0081: cmd = aiIfChrHealthGreaterThan(cmd); break; - case 0x0082: cmd = aiIfChrHealthLessThan(cmd); break; - case 0x0083: cmd = aiIfInjured(cmd); break; - case 0x0084: cmd = aiSetMorale(cmd); break; - case 0x0085: cmd = aiAddMorale(cmd); break; - case 0x0086: cmd = aiChrAddMorale(cmd); break; - case 0x0087: cmd = aiSubtractMorale(cmd); break; - case 0x0088: cmd = aiIfMoraleLessThan(cmd); break; - case 0x0089: cmd = aiIfMoraleLessThanRandom(cmd); break; - case 0x008a: cmd = aiSetAlertness(cmd); break; - case 0x008b: cmd = aiAddAlertness(cmd); break; - case 0x008c: cmd = aiChrAddAlertness(cmd); break; - case 0x008d: cmd = aiSubtractAlertness(cmd); break; - case 0x008e: cmd = aiIfAlertness(cmd); break; - case 0x008f: cmd = aiIfChrAlertnessLessThan(cmd); break; - case 0x0090: cmd = aiIfAlertnessLessThanRandom(cmd); break; - case 0x0091: cmd = aiNoOp0091(cmd); break; - case 0x0092: cmd = aiSetHearDistance(cmd); break; - case 0x0093: cmd = aiSetViewDistance(cmd); break; - case 0x0094: cmd = aiSetGrenadeProbability(cmd); break; - case 0x0095: cmd = aiSetChrNum(cmd); break; - case 0x0096: cmd = aiSetMaxDamage(cmd); break; - case 0x0097: cmd = aiAddHealth(cmd); break; - case 0x0098: cmd = aiSetReactionSpeed(cmd); break; - case 0x0099: cmd = aiSetRecoverySpeed(cmd); break; - case 0x009a: cmd = aiSetAccuracy(cmd); break; - case 0x009b: cmd = aiSetFlag(cmd); break; - case 0x009c: cmd = aiUnsetFlag(cmd); break; - case 0x009d: cmd = aiIfHasFlag(cmd); break; - case 0x009e: cmd = aiChrSetFlag(cmd); break; - case 0x009f: cmd = aiChrUnsetFlag(cmd); break; - case 0x00a0: cmd = aiIfChrHasFlag(cmd); break; - case 0x00a1: cmd = aiSetStageFlag(cmd); break; - case 0x00a2: cmd = aiUnsetStageFlag(cmd); break; - case 0x00a3: cmd = aiIfStageFlagEq(cmd); break; - case 0x00a4: cmd = aiSetChrflag(cmd); break; - case 0x00a5: cmd = aiUnsetChrflag(cmd); break; - case 0x00a6: cmd = aiIfHasChrflag(cmd); break; - case 0x00a7: cmd = aiChrSetChrflag(cmd); break; - case 0x00a8: cmd = aiChrUnsetChrflag(cmd); break; - case 0x00a9: cmd = aiIfChrHasChrflag(cmd); break; - case 0x00aa: cmd = aiSetObjFlag(cmd); break; - case 0x00ab: cmd = aiUnsetObjFlag(cmd); break; - case 0x00ac: cmd = aiIfObjHasFlag(cmd); break; - case 0x00ad: cmd = aiSetObjFlag2(cmd); break; - case 0x00ae: cmd = aiUnsetObjFlag2(cmd); break; - case 0x00af: cmd = aiIfObjHasFlag2(cmd); break; - case 0x00b0: cmd = aiSetChrPreset(cmd); break; - case 0x00b1: cmd = aiSetChrTarget(cmd); break; - case 0x00b2: cmd = aiSetPadPreset(cmd); break; - case 0x00b3: cmd = aiChrSetPadPreset(cmd); break; - case 0x00b4: cmd = aiChrCopyPadPreset(cmd); break; - case 0x00b5: cmd = aiPrint(cmd); break; - case 0x00b6: cmd = aiRestartTimer(cmd); break; - case 0x00b7: cmd = aiResetTimer(cmd); break; - case 0x00b8: cmd = aiPauseTimer(cmd); break; - case 0x00b9: cmd = aiResumeTimer(cmd); break; - case 0x00ba: cmd = aiIfTimerStopped(cmd); break; - case 0x00bb: cmd = aiIfTimerGreaterThanRandom(cmd); break; - case 0x00bc: cmd = aiIfTimerLessThan(cmd); break; - case 0x00bd: cmd = aiIfTimerGreaterThan(cmd); break; - case 0x00be: cmd = aiShowCountdownTimer(cmd); break; - case 0x00bf: cmd = aiHideCountdownTimer(cmd); break; - case 0x00c0: cmd = aiSetCountdownTimerValue(cmd); break; - case 0x00c1: cmd = aiStopCountdownTimer(cmd); break; - case 0x00c2: cmd = aiStartCountdownTimer(cmd); break; - case 0x00c3: cmd = aiIfCountdownTimerStopped(cmd); break; - case 0x00c4: cmd = aiIfCountdownTimerLessThan(cmd); break; - case 0x00c5: cmd = aiIfCountdownTimerGreaterThan(cmd); break; - case 0x00c6: cmd = aiSpawnChrAtPad(cmd); break; - case 0x00c7: cmd = aiSpawnChrAtChr(cmd); break; - case 0x00c8: cmd = aiTryEquipWeapon(cmd); break; - case 0x00c9: cmd = aiTryEquipHat(cmd); break; - case 0x00ca: cmd = aiDuplicateChr(cmd); break; - case 0x00cb: cmd = aiShowHudmsg(cmd); break; - case 0x00cc: cmd = aiShowHudmsgTopMiddle(cmd); break; - case 0x00cd: cmd = aiSpeak(cmd); break; - case 0x00ce: cmd = aiPlaySound(cmd); break; - case 0x00cf: cmd = ai00cf(cmd); break; - case 0x00d0: cmd = ai00d0(cmd); break; - case 0x00d1: cmd = ai00d1(cmd); break; - case 0x00d2: cmd = ai00d2(cmd); break; - case 0x00d3: cmd = aiAudioMuteChannel(cmd); break; - case 0x00d4: cmd = ai00d4(cmd); break; - case 0x00d5: cmd = aiHovercarBeginPath(cmd); break; - case 0x00d6: cmd = aiSetVehicleSpeed(cmd); break; - case 0x00d7: cmd = aiSetRotorSpeed(cmd); break; - case 0x00d8: cmd = aiNoOp00d8(cmd); break; - case 0x00d9: cmd = aiNoOp00d9(cmd); break; - case 0x00da: cmd = aiSetObjImage(cmd); break; - case 0x00db: cmd = aiNoOp00db(cmd); break; - case 0x00dc: cmd = aiEndLevel(cmd); break; - case 0x00dd: cmd = ai00dd(cmd); break; - case 0x00de: cmd = aiWarpJoToPad(cmd); break; - case 0x00df: cmd = ai00df(cmd); break; - case 0x00e0: cmd = aiRevokeControl(cmd); break; - case 0x00e1: cmd = aiGrantControl(cmd); break; - case 0x00e2: cmd = aiChrMoveToPad(cmd); break; - case 0x00e3: cmd = ai00e3(cmd); break; - case 0x00e4: cmd = ai00e4(cmd); break; - case 0x00e5: cmd = aiIfColourFadeComplete(cmd); break; - case 0x00e6: break; - case 0x00e7: break; - case 0x00e8: cmd = aiSetDoorOpen(cmd); break; - case 0x00e9: cmd = ai00e9(cmd); break; - case 0x00ea: cmd = aiIfNumPlayersLessThan(cmd); break; - case 0x00eb: cmd = aiIfChrAmmoQuantityLessThan(cmd); break; - case 0x00ec: cmd = aiChrDrawWeapon(cmd); break; - case 0x00ed: cmd = aiChrDrawWeaponInCutscene(cmd); break; - case 0x00ee: cmd = ai00ee(cmd); break; - case 0x00ef: cmd = aiIfObjInRoom(cmd); break; - case 0x00f0: cmd = ai00f0(cmd); break; - case 0x00f1: cmd = aiIfAttacking(cmd); break; - case 0x00f2: cmd = aiSwitchToAltSky(cmd); break; - case 0x00f3: cmd = aiChrSetInvincible(cmd); break; - case 0x00f4: cmd = ai00f4(cmd); break; - case 0x00f5: cmd = ai00f5(cmd); break; - case 0x00f6: cmd = ai00f6(cmd); break; - case 0x00f7: cmd = aiIfAllObjectivesComplete(cmd); break; - case 0x00f8: cmd = aiIfPlayerIsInvincible(cmd); break; - case 0x00f9: cmd = aiPlayXTrack(cmd); break; - case 0x00fa: cmd = aiStopXTrack(cmd); break; - case 0x00fb: cmd = aiChrExplosions(cmd); break; - case 0x00fc: cmd = aiIfKillCountGreaterThan(cmd); break; - case 0x00fd: cmd = ai00fd(cmd); break; - case 0x00fe: cmd = aiKillBond(cmd); break; - case 0x00ff: cmd = aiBeSurprisedSurrender(cmd); break; - case 0x0100: cmd = aiNoOp0100(cmd); break; - case 0x0101: cmd = aiNoOp0101(cmd); break; - case 0x0102: cmd = aiSetLights(cmd); break; - case 0x0103: cmd = aiIfPropPresetIsBlockingSightToTarget(cmd); break; - case 0x0104: cmd = aiRemoveObjectAtPropPreset(cmd); break; - case 0x0105: cmd = aiIfPropPresetHeightLessThan(cmd); break; - case 0x0106: cmd = aiSetTarget(cmd); break; - case 0x0107: cmd = aiIfPresetsTargetIsNotMyTarget(cmd); break; - case 0x0108: cmd = aiIfChrTarget(cmd); break; - case 0x0109: cmd = aiSetChrPresetToChrNearSelf(cmd); break; - case 0x010a: cmd = aiSetChrPresetToChrNearPad(cmd); break; - case 0x010b: cmd = aiChrSetTeam(cmd); break; - case 0x010c: cmd = aiIfCompareChrPresetsTeam(cmd); break; - case 0x010d: cmd = aiNoOp010d(cmd); break; - case 0x010e: cmd = aiSetShield(cmd); break; - case 0x010f: cmd = aiIfChrShieldLessThan(cmd); break; - case 0x0110: cmd = aiIfChrShieldGreaterThan(cmd); break; - case 0x0111: cmd = aiSetCameraAnimation(cmd); break; - case 0x0112: cmd = aiObjectDoAnimation(cmd); break; - case 0x0113: cmd = aiIfInCutscene(cmd); break; - case 0x0114: cmd = aiEnableChr(cmd); break; - case 0x0115: cmd = aiDisableChr(cmd); break; - case 0x0116: cmd = aiEnableObj(cmd); break; - case 0x0117: cmd = aiDisableObj(cmd); break; - case 0x0118: cmd = aiSetObjFlag3(cmd); break; - case 0x0119: cmd = aiUnsetObjFlag3(cmd); break; - case 0x011a: cmd = aiIfObjHasFlag3(cmd); break; - case 0x011b: cmd = aiChrSetHiddenFlag(cmd); break; - case 0x011c: cmd = aiChrUnsetHiddenFlag(cmd); break; - case 0x011d: cmd = aiIfChrHasHiddenFlag(cmd); break; - case 0x011e: cmd = aiIfHuman(cmd); break; - case 0x011f: cmd = aiIfSkedar(cmd); break; - case 0x0120: cmd = aiIfSafety2LessThan(cmd); break; - case 0x0121: cmd = aiFindCover(cmd); break; - case 0x0122: cmd = aiFindCoverWithinDist(cmd); break; - case 0x0123: cmd = aiFindCoverOutsideDist(cmd); break; - case 0x0124: cmd = aiGoToCover(cmd); break; - case 0x0125: cmd = aiCheckCoverOutOfSight(cmd); break; - case 0x0126: cmd = aiIfPlayerUsingCmpOrAr34(cmd); break; - case 0x0127: cmd = aiDetectEnemyOnSameFloor(cmd); break; - case 0x0128: cmd = aiDetectEnemy(cmd); break; - case 0x0129: cmd = aiIfSafetyLessThan(cmd); break; - case 0x012a: cmd = aiIfTargetMovingSlowly(cmd); break; - case 0x012b: cmd = aiIfTargetMovingCloser(cmd); break; - case 0x012c: cmd = aiIfTargetMovingAway(cmd); break; - case 0x012d: break; - case 0x012e: break; - case 0x012f: cmd = ai012f(cmd); break; - case 0x0130: cmd = aiSayQuip(cmd); break; - case 0x0131: cmd = aiIncreaseSquadronAlertness(cmd); break; - case 0x0132: cmd = aiSetAction(cmd); break; - case 0x0133: cmd = aiSetTeamOrders(cmd); break; - case 0x0134: cmd = aiIfOrders(cmd); break; - case 0x0135: cmd = aiIfHasOrders(cmd); break; - case 0x0136: cmd = aiRetreat(cmd); break; - case 0x0137: cmd = aiIfChrInSquadronDoingAction(cmd); break; - case 0x0138: cmd = aiIfChannelIdle(cmd); break; - case 0x0139: cmd = ai0139(cmd); break; - case 0x013a: cmd = aiSetChrPresetToUnalertedTeammate(cmd); break; - case 0x013b: cmd = aiSetSquadron(cmd); break; - case 0x013c: cmd = aiFaceCover(cmd); break; - case 0x013d: cmd = aiIfDangerousObjectNearby(cmd); break; - case 0x013e: cmd = ai013e(cmd); break; - case 0x013f: cmd = aiIfHeliWeaponsArmed(cmd); break; - case 0x0140: cmd = aiIfHoverbotNextStep(cmd); break; - case 0x0141: cmd = aiShuffleInvestigationTerminals(cmd); break; - case 0x0142: cmd = aiSetPadPresetToInvestigationTerminal(cmd); break; - case 0x0143: cmd = aiHeliArmWeapons(cmd); break; - case 0x0144: cmd = aiHeliUnarmWeapons(cmd); break; - case 0x0145: cmd = aiRebuildTeams(cmd); break; - case 0x0146: cmd = aiRebuildSquadrons(cmd); break; - case 0x0147: cmd = aiIfSquadronIsDead(cmd); break; - case 0x0148: cmd = aiChrSetListening(cmd); break; - case 0x0149: cmd = aiIfChrListening(cmd); break; - case 0x014a: cmd = aiIfTrue(cmd); break; - case 0x014b: cmd = aiIfNotListening(cmd); break; - case 0x014c: break; - case 0x014d: break; - case 0x014e: break; - case 0x014f: break; - case 0x0150: break; - case 0x0151: break; - case 0x0152: cmd = aiIfNumChrsInSquadronGreaterThan(cmd); break; - case 0x0153: break; - case 0x0154: break; - case 0x0155: break; - case 0x0156: break; - case 0x0157: cmd = aiSetTintedGlassEnabled(cmd); break; - case 0x0158: break; - case 0x0159: break; - case 0x015a: break; - case 0x015b: cmd = aiPlayTrackIsolated(cmd); break; - case 0x015c: cmd = aiPlayDefaultTracks(cmd); break; - case 0x015d: break; - case 0x015e: break; - case 0x015f: break; - case 0x0160: break; - case 0x0161: break; - case 0x0162: break; - case 0x0163: break; - case 0x0164: break; - case 0x0165: cmd = aiIfChrInjured(cmd); break; - case 0x0166: cmd = aiIfAction(cmd); break; - case 0x0167: cmd = aiHovercopterFireRocket(cmd); break; - case 0x0168: cmd = aiIfShieldDamaged(cmd); break; - case 0x0169: cmd = aiIfNaturalAnim(cmd); break; - case 0x016a: cmd = aiIfY(cmd); break; - case 0x016b: cmd = ai016b(cmd); break; - case 0x016c: cmd = aiNoOp016c(cmd); break; - case 0x016d: cmd = aiChrAdjustMotionBlur(cmd); break; - case 0x016e: cmd = aiDamageChrByAmount(cmd); break; - case 0x016f: cmd = aiIfChrHasGun(cmd); break; - case 0x0170: cmd = aiDoGunCommand(cmd); break; - case 0x0171: cmd = aiIfDistanceToGunLessThan(cmd); break; - case 0x0172: cmd = aiRecoverGun(cmd); break; - case 0x0173: cmd = aiChrCopyProperties(cmd); break; - case 0x0174: cmd = aiIfCutsceneButtonPressed(cmd); break; - case 0x0175: cmd = ai0175(cmd); break; - case 0x0176: cmd = ai0176(cmd); break; - case 0x0177: cmd = aiPlayerAutoWalk(cmd); break; - case 0x0178: cmd = aiIfPlayerAutoWalkFinished(cmd); break; - case 0x0179: cmd = ai0179(cmd); break; - case 0x017a: cmd = aiIfCanSeeAttackTarget(cmd); break; - case 0x017b: cmd = aiIfChrKnockedOut(cmd); break; - case 0x017c: cmd = aiAssignSound(cmd); break; - case 0x017d: cmd = aiPlayCutsceneTrack(cmd); break; - case 0x017e: cmd = aiStopCutsceneTrack(cmd); break; - case 0x017f: cmd = aiPlayTemporaryTrack(cmd); break; - case 0x0180: cmd = aiStopAmbientTrack(cmd); break; - case 0x0181: cmd = aiIfPlayerLookingAtObject(cmd); break; - case 0x0182: cmd = aiPunchOrKick(cmd); break; - case 0x0183: cmd = aiIfTargetIsPlayer(cmd); break; - case 0x0184: cmd = ai0184(cmd); break; - case 0x0185: cmd = aiMpInitSimulants(cmd); break; - case 0x0186: cmd = aiIfSoundTimer(cmd); break; - case 0x0187: cmd = aiSetTargetToEyespyIfInSight(cmd); break; - case 0x0188: cmd = aiIfLiftStationary(cmd); break; - case 0x0189: cmd = aiLiftGoToStop(cmd); break; - case 0x018a: cmd = aiIfLiftAtStop(cmd); break; - case 0x018b: cmd = aiConfigureRain(cmd); break; - case 0x018c: cmd = aiChrToggleModelPart(cmd); break; - case 0x018d: cmd = aiActivateLift(cmd); break; - case 0x018e: cmd = aiMiniSkedarTryPounce(cmd); break; - case 0x018f: cmd = aiIfObjectDistanceToPadLessThan(cmd); break; - case 0x0190: cmd = aiSetSavefileFlag(cmd); break; - case 0x0191: cmd = aiUnsetSavefileFlag(cmd); break; - case 0x0192: cmd = aiIfSavefileFlagIsSet(cmd); break; - case 0x0193: cmd = aiIfSavefileFlagIsUnset(cmd); break; - case 0x0194: break; - case 0x0195: break; - case 0x0196: break; - case 0x0197: break; - case 0x0198: break; - case 0x0199: break; - case 0x019a: break; - case 0x019b: break; - case 0x019c: break; - case 0x019d: break; - case 0x019e: cmd = aiIfObjHealthLessThan(cmd); break; - case 0x019f: cmd = aiSetObjHealth(cmd); break; - case 0x01a0: cmd = aiSetChrSpecialDeathAnimation(cmd); break; - case 0x01a1: cmd = aiSetRoomToSearch(cmd); break; - case 0x01a2: cmd = aiSayCiStaffQuip(cmd); break; - case 0x01a3: cmd = aiDoPresetAnimation(cmd); break; - case 0x01a4: cmd = aiShowHudmsgMiddle(cmd); break; - case 0x01a5: cmd = aiIfUsingLift(cmd); break; - case 0x01a6: cmd = aiIfTargetYDifferenceLessThan(cmd); break; - case 0x01a7: cmd = aiIfChrNotTalking(cmd); break; - case 0x01a8: break; - case 0x01a9: break; - case 0x01aa: cmd = ai01aa(cmd); break; - case 0x01ab: cmd = aiIfNumKnockedOutChrs(cmd); break; - case 0x01ac: break; - case 0x01ad: cmd = aiReleaseObject(cmd); break; - case 0x01ae: cmd = aiClearInventory(cmd); break; - case 0x01af: cmd = aiChrGrabObject(cmd); break; - case 0x01b0: break; - case 0x01b1: cmd = aiShuffleRuinsPillars(cmd); break; - case 0x01b2: cmd = aiSetWindSpeed(cmd); break; - case 0x01b3: cmd = aiToggleP1P2(cmd); break; - case 0x01b4: cmd = ai01b4(cmd); break; - case 0x01b5: cmd = aiChrSetP1P2(cmd); break; - case 0x01b6: cmd = aiConfigureSnow(cmd); break; - case 0x01b7: cmd = aiChrSetCloaked(cmd); break; - case 0x01b8: cmd = aiSetAutogunTargetTeam(cmd); break; - case 0x01b9: cmd = aiShufflePelagicSwitches(cmd); break; - case 0x01ba: cmd = aiTryAttackLie(cmd); break; - case 0x01bb: cmd = aiNoOp01bb(cmd); break; - case 0x01bc: cmd = ai01bc(cmd); break; - case 0x01bd: cmd = aiIfTrainingPcHolographed(cmd); break; - case 0x01be: cmd = aiIfPlayerUsingDevice(cmd); break; - case 0x01bf: cmd = aiChrBeginOrEndTeleport(cmd); break; - case 0x01c0: cmd = aiIfChrTeleportFullWhite(cmd); break; - case 0x01c1: cmd = aiSetPunchDodgeList(cmd); break; - case 0x01c2: cmd = aiSetShootingAtMeList(cmd); break; - case 0x01c3: cmd = aiSetDarkRoomList(cmd); break; - case 0x01c4: cmd = aiSetPlayerDeadList(cmd); break; - case 0x01c5: cmd = aiAvoid(cmd); break; - case 0x01c6: cmd = aiSetDodgeRating(cmd); break; - case 0x01c7: cmd = aiSetUnarmedDodgeRating(cmd); break; - case 0x01c8: cmd = aiTitleInitMode(cmd); break; - case 0x01c9: cmd = aiTryExitTitle(cmd); break; - case 0x01ca: cmd = aiChrSetCutsceneWeapon(cmd); break; - case 0x01cb: cmd = aiFadeScreen(cmd); break; - case 0x01cc: cmd = aiIfFadeComplete(cmd); break; - case 0x01cd: cmd = aiSetChrHudpieceVisible(cmd); break; - case 0x01ce: cmd = aiSetPassiveMode(cmd); break; - case 0x01cf: cmd = aiChrSetFiringInCutscene(cmd); break; - case 0x01d0: cmd = aiSetPortalFlag(cmd); break; - case 0x01d1: cmd = aiObjSetModelPartVisible(cmd); break; - case 0x01d2: cmd = aiChrEmitSparks(cmd); break; - case 0x01d3: cmd = aiSetDrCarollImages(cmd); break; - case 0x01d4: cmd = aiSetRoomFlag(cmd); break; - case 0x01d5: cmd = aiShowCutsceneChrs(cmd); break; - case 0x01d6: cmd = aiConfigureEnvironment(cmd); break; - case 0x01d7: cmd = aiIfDistanceToTarget2LessThan(cmd); break; - case 0x01d8: cmd = aiIfDistanceToTarget2GreaterThan(cmd); break; - case 0x01d9: cmd = aiPlaySoundFromProp(cmd); break; - case 0x01da: cmd = aiPlayTemporaryPrimaryTrack(cmd); break; - case 0x01db: cmd = aiChrKill(cmd); break; - case 0x01dc: cmd = aiRemoveWeaponFromInventory(cmd); break; - case 0x01dd: cmd = aiIfMusicEventQueueIsEmpty(cmd); break; - case 0x01de: cmd = aiIfCoopMode(cmd); break; - case 0x01df: cmd = aiIfChrSameFloorDistanceToPadLessThan(cmd); break; - case 0x01e0: cmd = aiRemoveReferencesToChr(cmd); break; + switch (cmd[0]) { + case 0x00: cmd = aiGoToNext(cmd); break; + case 0x01: cmd = aiGoToFirst(cmd); break; + case 0x02: cmd = aiIfIdle(cmd); break; + case 0x03: cmd = aiTrySidestep(cmd); break; + case 0x04: cmd = aiTryJumpOut(cmd); break; + case 0x05: cmd = aiTryRunSideways(cmd); break; + case 0x06: cmd = aiTryAttackWalk(cmd); break; + case 0x07: cmd = aiTryAttackRoll(cmd); break; + case 0x08: cmd = aiTryAttackStand(cmd); break; + case 0x09: cmd = aiTryAttackKneel(cmd); break; + case 0x0a: cmd = aiTryModifyAttack(cmd); break; + case 0x0b: cmd = aiFaceEntity(cmd); break; + case 0x0c: cmd = aiConsiderGrenadeThrow(cmd); break; + case 0x0d: cmd = aiIfPatrolling(cmd); break; + case 0x0e: cmd = aiTryJogToTargetProp(cmd); break; + case 0x0f: cmd = aiTryWalkToTargetProp(cmd); break; + case 0x10: cmd = aiTryRunToTargetProp(cmd); break; + case 0x11: cmd = aiTryJogToChr(cmd); break; + case 0x12: cmd = aiTryRunToChr(cmd); break; + case 0x13: cmd = aiIfStopped(cmd); break; + case 0x14: cmd = aiIfChrDead(cmd); break; + case 0x15: cmd = aiIfChrDeathAnimationFinished(cmd); break; + case 0x16: cmd = aiIfTargetInSight(cmd); break; + case 0x17: cmd = aiIfRandomLessThan(cmd); break; + case 0x18: cmd = aiIfRandomGreaterThan(cmd); break; + case 0x19: cmd = aiIfCanHearAlarm(cmd); break; + case 0x1a: cmd = aiIfAlarmActive(cmd); break; + case 0x1b: cmd = aiIfHearsTarget(cmd); break; + case 0x1c: cmd = aiIfSawInjury(cmd); break; + case 0x1d: cmd = aiIfSawDeath(cmd); break; + case 0x1e: cmd = aiIfCanSeeTarget(cmd); break; + case 0x1f: cmd = aiIfNearlyInTargetsSight(cmd); break; + case 0x20: cmd = aiIfHeardTargetRecently(cmd); break; + case 0x21: cmd = ai0045(cmd); break; + case 0x22: cmd = aiIfNeverBeenOnScreen(cmd); break; + case 0x23: cmd = aiIfOnScreen(cmd); break; + case 0x24: cmd = aiIfRoomIsOnScreen(cmd); break; + case 0x25: cmd = ai004a(cmd); break; + case 0x26: cmd = aiIfNearMiss(cmd); break; + case 0x27: cmd = aiIfSeesSuspiciousItem(cmd); break; + case 0x28: cmd = aiIfTargetInFovLeft(cmd); break; + case 0x29: cmd = aiIfCheckFovWithTarget(cmd); break; + case 0x2a: cmd = aiIfTargetOutOfFovLeft(cmd); break; + case 0x2b: cmd = aiIfTargetInFov(cmd); break; + case 0x2c: cmd = aiIfDistanceToTargetLessThan(cmd); break; + case 0x2d: cmd = aiIfDistanceToTargetGreaterThan(cmd); break; + case 0x2e: cmd = aiIfChrDistanceToPadLessThan(cmd); break; + case 0x2f: cmd = aiIfChrDistanceToPadGreaterThan(cmd); break; + case 0x30: cmd = aiIfDistanceToChrLessThan(cmd); break; + case 0x31: cmd = aiIfDistanceToChrGreaterThan(cmd); break; + case 0x32: cmd = aiIfDistanceFromTargetToPadLessThan(cmd); break; + case 0x33: cmd = aiIfChrInRoom(cmd); break; + case 0x34: cmd = aiIfChrHasObject(cmd); break; + case 0x35: cmd = aiIfWeaponThrown(cmd); break; + case 0x36: cmd = aiIfWeaponThrownOnObject(cmd); break; + case 0x37: cmd = aiIfChrHasWeaponEquipped(cmd); break; + case 0x38: cmd = aiIfGunUnclaimed(cmd); break; + case 0x39: cmd = aiIfObjectHealthy(cmd); break; + case 0x3a: cmd = aiIfChrActivatedObject(cmd); break; + case 0x3b: cmd = aiIfDoorState(cmd); break; + case 0x3c: cmd = aiIfDoorLocked(cmd); break; + case 0x3d: cmd = aiIfObjectiveComplete(cmd); break; + case 0x3e: cmd = aiIfObjectiveFailed(cmd); break; + case 0x3f: cmd = ai0075(cmd); break; + case 0x40: cmd = aiSetPadPresetToTargetQuadrant(cmd); break; + case 0x41: cmd = aiIfDifficultyLessThan(cmd); break; + case 0x42: cmd = aiIfDifficultyGreaterThan(cmd); break; + case 0x43: cmd = aiIfStageIsNot(cmd); break; + case 0x44: cmd = aiIfNumArghsLessThan(cmd); break; + case 0x45: cmd = aiIfNumArghsGreaterThan(cmd); break; + case 0x46: cmd = aiIfInjured(cmd); break; + case 0x47: cmd = aiIfMoraleLessThan(cmd); break; + case 0x48: cmd = aiIfAlertness(cmd); break; + case 0x49: cmd = aiIfChrAlertnessLessThan(cmd); break; + case 0x4a: cmd = aiIfHasFlag(cmd); break; + case 0x4b: cmd = aiIfChrHasFlag(cmd); break; + case 0x4c: cmd = aiIfStageFlagEq(cmd); break; + case 0x4d: cmd = aiIfHasChrflag(cmd); break; + case 0x4e: cmd = aiIfChrHasChrflag(cmd); break; + case 0x4f: cmd = aiIfObjHasFlag2(cmd); break; + case 0x50: cmd = aiIfTimerLessThan(cmd); break; + case 0x51: cmd = aiIfTimerGreaterThan(cmd); break; + case 0x52: cmd = aiIfCountdownTimerLessThan(cmd); break; + case 0x53: cmd = aiIfCountdownTimerGreaterThan(cmd); break; + case 0x54: cmd = aiSpawnChrAtPad(cmd); break; + case 0x55: cmd = aiSpawnChrAtChr(cmd); break; + case 0x56: cmd = aiTryEquipWeapon(cmd); break; + case 0x57: cmd = aiDuplicateChr(cmd); break; + case 0x58: cmd = aiChrMoveToPad(cmd); break; + case 0x59: cmd = aiIfNumPlayersLessThan(cmd); break; + case 0x5a: cmd = aiIfChrAmmoQuantityLessThan(cmd); break; + case 0x5b: cmd = aiIfObjInRoom(cmd); break; + case 0x5c: cmd = aiIfAllObjectivesComplete(cmd); break; + case 0x5d: cmd = aiIfKillCountGreaterThan(cmd); break; + case 0x5e: cmd = aiIfPresetsTargetIsNotMyTarget(cmd); break; + case 0x5f: cmd = aiIfChrTarget(cmd); break; + case 0x60: cmd = aiIfChrShieldLessThan(cmd); break; + case 0x61: cmd = aiIfInCutscene(cmd); break; + case 0x62: cmd = aiIfObjHasFlag3(cmd); break; + case 0x63: cmd = aiIfChrHasHiddenFlag(cmd); break; + case 0x64: cmd = aiIfSkedar(cmd); break; + case 0x65: cmd = aiIfSafety2LessThan(cmd); break; + case 0x66: cmd = aiFindCover(cmd); break; + case 0x67: cmd = aiCheckCoverOutOfSight(cmd); break; + case 0x68: cmd = aiIfPlayerUsingCmpOrAr34(cmd); break; + case 0x69: cmd = aiDetectEnemyOnSameFloor(cmd); break; + case 0x6a: cmd = aiDetectEnemy(cmd); break; + case 0x6b: cmd = aiIfTargetMovingSlowly(cmd); break; + case 0x6c: cmd = aiIfTargetMovingCloser(cmd); break; + case 0x6d: cmd = aiIfTargetMovingAway(cmd); break; + case 0x6e: cmd = aiSetTeamOrders(cmd); break; + case 0x6f: cmd = aiIfOrders(cmd); break; + case 0x70: cmd = aiIfHasOrders(cmd); break; + case 0x71: cmd = aiIfChrInSquadronDoingAction(cmd); break; + case 0x72: cmd = aiIfChannelIdle(cmd); break; + case 0x73: cmd = aiSetChrPresetToUnalertedTeammate(cmd); break; + case 0x74: cmd = aiIfDangerousObjectNearby(cmd); break; + case 0x75: cmd = aiIfHoverbotNextStep(cmd); break; + case 0x76: cmd = aiIfSquadronIsDead(cmd); break; + case 0x77: cmd = aiIfNumChrsInSquadronGreaterThan(cmd); break; + case 0x78: cmd = aiIfChrInjured(cmd); break; + case 0x79: cmd = aiIfShieldDamaged(cmd); break; + case 0x7a: cmd = aiIfNaturalAnim(cmd); break; + case 0x7b: cmd = aiIfY(cmd); break; + case 0x7c: cmd = aiIfChrHasGun(cmd); break; + case 0x7d: cmd = aiDoGunCommand(cmd); break; + case 0x7e: cmd = aiIfDistanceToGunLessThan(cmd); break; + case 0x7f: cmd = aiRecoverGun(cmd); break; + case 0x80: cmd = aiChrCopyProperties(cmd); break; + case 0x81: cmd = ai0176(cmd); break; + case 0x82: cmd = aiIfCanSeeAttackTarget(cmd); break; + case 0x83: cmd = aiIfChrKnockedOut(cmd); break; + case 0x84: cmd = aiIfPlayerLookingAtObject(cmd); break; + case 0x85: cmd = aiPunchOrKick(cmd); break; + case 0x86: cmd = aiIfTargetIsPlayer(cmd); break; + case 0x87: cmd = aiIfSoundTimer(cmd); break; + case 0x88: cmd = aiSetTargetToEyespyIfInSight(cmd); break; + case 0x89: cmd = aiIfLiftStationary(cmd); break; + case 0x8a: cmd = aiMiniSkedarTryPounce(cmd); break; + case 0x8b: cmd = aiIfObjectDistanceToPadLessThan(cmd); break; + case 0x8c: cmd = aiIfObjHealthLessThan(cmd); break; + case 0x8d: cmd = aiIfChrNotTalking(cmd); break; + case 0x8e: cmd = aiIfNumKnockedOutChrs(cmd); break; + case 0x8f: cmd = ai01b4(cmd); break; + case 0x90: cmd = aiTryAttackLie(cmd); break; + case 0x91: cmd = aiIfPlayerUsingDevice(cmd); break; + case 0x92: cmd = aiIfCoopMode(cmd); break; + case 0x93: cmd = aiIfChrSameFloorDistanceToPadLessThan(cmd); break; + case 0x94: cmd = aiLabel(cmd); break; + case 0x95: cmd = aiYield(cmd); break; + case 0x96: cmd = aiEndList(cmd); break; + case 0x97: cmd = aiSetList(cmd); break; + case 0x98: cmd = aiSetReturnList(cmd); break; + case 0x99: cmd = aiSetShotList(cmd); break; + case 0x9a: cmd = aiReturn(cmd); break; + case 0x9b: cmd = aiStop(cmd); break; + case 0x9c: cmd = aiKneel(cmd); break; + case 0x9d: cmd = aiChrDoAnimation(cmd); break; + case 0x9e: cmd = ai0019(cmd); break; + case 0x9f: cmd = aiChrDamageChr(cmd); break; + case 0xa0: cmd = aiJogToPad(cmd); break; + case 0xa1: cmd = aiGoToPadPreset(cmd); break; + case 0xa2: cmd = aiWalkToPad(cmd); break; + case 0xa3: cmd = aiRunToPad(cmd); break; + case 0xa4: cmd = aiFadeOut(cmd); break; + case 0xa5: cmd = aiRemoveChr(cmd); break; + case 0xa6: cmd = aiActivateAlarm(cmd); break; + case 0xa7: cmd = aiDeactivateAlarm(cmd); break; + case 0xa8: cmd = aiRandom(cmd); break; + case 0xa9: cmd = aiDestroyObject(cmd); break; + case 0xaa: cmd = aiChrDropItems(cmd); break; + case 0xab: cmd = aiChrDropWeapon(cmd); break; + case 0xac: cmd = aiGiveObjectToChr(cmd); break; + case 0xad: cmd = aiObjectMoveToPad(cmd); break; + case 0xae: cmd = aiOpenDoor(cmd); break; + case 0xaf: cmd = aiCloseDoor(cmd); break; + case 0xb0: cmd = aiUnlockDoor(cmd); break; + case 0xb1: cmd = aiSetMorale(cmd); break; + case 0xb2: cmd = aiAddMorale(cmd); break; + case 0xb3: cmd = aiSubtractMorale(cmd); break; + case 0xb4: cmd = aiSetAlertness(cmd); break; + case 0xb5: cmd = aiAddAlertness(cmd); break; + case 0xb6: cmd = aiChrAddAlertness(cmd); break; + case 0xb7: cmd = aiSetHearDistance(cmd); break; + case 0xb8: cmd = aiSetViewDistance(cmd); break; + case 0xb9: cmd = aiSetFlag(cmd); break; + case 0xba: cmd = aiUnsetFlag(cmd); break; + case 0xbb: cmd = aiChrSetFlag(cmd); break; + case 0xbc: cmd = aiChrUnsetFlag(cmd); break; + case 0xbd: cmd = aiSetStageFlag(cmd); break; + case 0xbe: cmd = aiUnsetStageFlag(cmd); break; + case 0xbf: cmd = aiSetChrflag(cmd); break; + case 0xc0: cmd = aiUnsetChrflag(cmd); break; + case 0xc1: cmd = aiChrSetChrflag(cmd); break; + case 0xc2: cmd = aiChrUnsetChrflag(cmd); break; + case 0xc3: cmd = aiSetObjFlag(cmd); break; + case 0xc4: cmd = aiUnsetObjFlag(cmd); break; + case 0xc5: cmd = aiSetObjFlag2(cmd); break; + case 0xc6: cmd = aiUnsetObjFlag2(cmd); break; + case 0xc7: cmd = aiSetChrPreset(cmd); break; + case 0xc8: cmd = aiSetChrTarget(cmd); break; + case 0xc9: cmd = aiSetPadPreset(cmd); break; + case 0xca: cmd = aiRestartTimer(cmd); break; + case 0xcb: cmd = aiResetTimer(cmd); break; + case 0xcc: cmd = aiPauseTimer(cmd); break; + case 0xcd: cmd = aiResumeTimer(cmd); break; + case 0xce: cmd = aiShowHudmsg(cmd); break; + case 0xcf: cmd = aiShowHudmsgTopMiddle(cmd); break; + case 0xd0: cmd = aiSpeak(cmd); break; + case 0xd1: cmd = aiPlaySound(cmd); break; + case 0xd2: cmd = ai00cf(cmd); break; + case 0xd3: cmd = aiAudioMuteChannel(cmd); break; + case 0xd4: cmd = aiSetObjImage(cmd); break; + case 0xd5: cmd = aiSetDoorOpen(cmd); break; + case 0xd6: cmd = aiChrDrawWeapon(cmd); break; + case 0xd7: cmd = aiSetTarget(cmd); break; + case 0xd8: cmd = aiObjectDoAnimation(cmd); break; + case 0xd9: cmd = aiEnableChr(cmd); break; + case 0xda: cmd = aiDisableChr(cmd); break; + case 0xdb: cmd = aiEnableObj(cmd); break; + case 0xdc: cmd = aiDisableObj(cmd); break; + case 0xdd: cmd = aiSetObjFlag3(cmd); break; + case 0xde: cmd = aiUnsetObjFlag3(cmd); break; + case 0xdf: cmd = aiChrSetHiddenFlag(cmd); break; + case 0xe0: cmd = aiChrUnsetHiddenFlag(cmd); break; + case 0xe1: cmd = aiGoToCover(cmd); break; + case 0xe2: cmd = ai012f(cmd); break; + case 0xe3: cmd = aiSayQuip(cmd); break; + case 0xe4: cmd = aiIncreaseSquadronAlertness(cmd); break; + case 0xe5: cmd = aiSetAction(cmd); break; + case 0xe6: cmd = aiRetreat(cmd); break; + case 0xe7: cmd = ai0139(cmd); break; + case 0xe8: cmd = ai013e(cmd); break; + case 0xe9: cmd = aiRebuildTeams(cmd); break; + case 0xea: cmd = aiHovercopterFireRocket(cmd); break; + case 0xeb: cmd = aiDamageChrByAmount(cmd); break; + case 0xec: cmd = ai0175(cmd); break; + case 0xed: cmd = ai0179(cmd); break; + case 0xee: cmd = aiAssignSound(cmd); break; + case 0xef: cmd = ai0184(cmd); break; + case 0xf0: cmd = aiSetObjHealth(cmd); break; + case 0xf1: cmd = aiSetChrSpecialDeathAnimation(cmd); break; + case 0xf2: cmd = aiSetRoomToSearch(cmd); break; + case 0xf3: cmd = aiDoPresetAnimation(cmd); break; + case 0xf4: cmd = aiShowHudmsgMiddle(cmd); break; + case 0xf5: cmd = aiToggleP1P2(cmd); break; + case 0xf6: cmd = aiChrSetCloaked(cmd); break; + case 0xf7: cmd = aiSetAutogunTargetTeam(cmd); break; + case 0xf8: cmd = aiSetShootingAtMeList(cmd); break; + case 0xf9: cmd = aiSetDarkRoomList(cmd); break; + case 0xfa: cmd = aiFadeScreen(cmd); break; + case 0xfb: cmd = aiChrEmitSparks(cmd); break; + case 0xfc: cmd = aiChrKill(cmd); break; + case 0xff: cmd = aiSubCommand(cmd); break; + default: + while (1); } } while (cmd); } diff --git a/src/game/gailists.c b/src/game/gailists.c index 02a476ed1..650bc0284 100644 --- a/src/game/gailists.c +++ b/src/game/gailists.c @@ -5220,8 +5220,6 @@ u8 func0014_buddy_main[] = { * Not used. */ u8 func002b_avoid[] = { - avoid - beginloop(0x03) if_chr_stopped(/*goto*/ 0x16) endloop(0x03) diff --git a/src/include/commands.h b/src/include/commands.h index 57b7ad87e..98b91f5ee 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -15,7 +15,7 @@ * label command, so this will match beginloops too. */ #define goto_first(label) \ - mkshort(0x0001), \ + mkshort(0x0100), \ label, /** @@ -27,7 +27,7 @@ * command. */ #define label(id) \ - mkshort(0x0002), \ + mkshort(0x9400), \ id, /** @@ -45,7 +45,7 @@ * may need to yield before detonating it. */ #define yield \ - mkshort(0x0003), + mkshort(0x9500), /** * Marks the end of the ailist. @@ -55,7 +55,7 @@ * or assign a different ailist before the end is reached. */ #define endlist \ - mkshort(0x0004), + mkshort(0x9600), /** * Assigns a new ailist to the given chr. If the given chr is the current chr, @@ -63,7 +63,7 @@ * yield). */ #define set_ailist(chr, ailist) \ - mkshort(0x0005), \ + mkshort(0x9700), \ chr, \ mkshort(ailist), @@ -76,7 +76,7 @@ * to the original ailist. */ #define set_returnlist(chr, ailist) \ - mkshort(0x0006), \ + mkshort(0x9800), \ chr, \ mkshort(ailist), @@ -91,7 +91,7 @@ * continue their regular logic. */ #define set_shotlist(ailist) \ - mkshort(0x0007), \ + mkshort(0x9900), \ mkshort(ailist), /** @@ -99,19 +99,19 @@ * is started from the top. */ #define return \ - mkshort(0x0008), + mkshort(0x9a00), /** * Makes the chr stop doing whatever they were doing (eg. running). */ #define stop_chr \ - mkshort(0x0009), + mkshort(0x9b00), /** * Makes the chr begin kneeling. */ #define kneel \ - mkshort(0x000a), + mkshort(0x9c00), /** * Make a chr do an animation. See the ANIM constants in constants.h for known @@ -125,7 +125,7 @@ * chranimflags is expected to be a CHRANIMFLAG constant. */ #define chr_do_animation(animation, startframe, endframe, chranimflags, timemerge, chr, animspeed) \ - mkshort(0x000b), \ + mkshort(0x9d00), \ mkshort(animation), \ mkshort(startframe), \ mkshort(endframe), \ @@ -143,31 +143,15 @@ * - idle animations such as yawning */ #define if_chr_idle(label) \ - mkshort(0x000c), \ + mkshort(0x0200), \ label, -/** - * Makes the chr raise one hand briefly. - * This isn't used, but was copied from GoldenEye and still works. - */ -#define be_surprised_one_hand \ - mkshort(0x000d), - -/** - * Makes the chr look over their shoulder. - * - * This command isn't used. The "surprised" part of the name is there because - * this is internally implemented using the ACT_SURPRISED action. - */ -#define be_surprised_look_around \ - mkshort(0x000e), - /** * Attempt to jump sideways. If it worked then go to the given label. * The command may fail if the chr is blocked. */ #define try_sidestep(label) \ - mkshort(0x000f), \ + mkshort(0x0300), \ label, /** @@ -175,7 +159,7 @@ * The command may fail if the chr is blocked. */ #define try_jumpout(label) \ - mkshort(0x0010), \ + mkshort(0x0400), \ label, /** @@ -183,7 +167,7 @@ * The command may fail if the chr is blocked. */ #define try_run_sideways(label) \ - mkshort(0x0011), \ + mkshort(0x0500), \ label, /** @@ -192,16 +176,7 @@ * their target. */ #define try_attack_walk(label) \ - mkshort(0x0012), \ - label, - -/** - * Attempt to run and shoot. If it worked then go to the given label. - * The command may fail if the chr is blocked, or maybe if the chr can't see - * their target. - */ -#define try_attack_run(label) \ - mkshort(0x0013), \ + mkshort(0x0600), \ label, /** @@ -210,7 +185,7 @@ * their target. */ #define try_attack_roll(label) \ - mkshort(0x0014), \ + mkshort(0x0700), \ label, /** @@ -219,7 +194,7 @@ * attackflags is expected to be a bitfield of ATTACKFLAG constants. */ #define try_attack_stand(attackflags, entity_id, label) \ - mkshort(0x0015), \ + mkshort(0x0800), \ mkshort(attackflags), \ mkshort(entity_id), \ label, @@ -230,7 +205,7 @@ * attackflags is expected to be a bitfield of ATTACKFLAG constants. */ #define try_attack_kneel(attackflags, entity_id, label) \ - mkshort(0x0016), \ + mkshort(0x0900), \ mkshort(attackflags), \ mkshort(entity_id), \ label, @@ -245,7 +220,7 @@ * ATTACKFLAG_AIMONLY flag, causing the chr to shoot. */ #define try_modify_attack(attackflags, entity_id, label) \ - mkshort(0x0017), \ + mkshort(0x0a00), \ mkshort(attackflags), \ mkshort(entity_id), \ label, @@ -257,7 +232,7 @@ * attackflags is expected to be a bitfield of ATTACKFLAG constants. */ #define try_face_entity(attackflags, entity_id, label) \ - mkshort(0x0018), \ + mkshort(0x0b00), \ mkshort(attackflags), \ mkshort(entity_id), \ label, @@ -266,7 +241,7 @@ * Damages the chr using the given weapon's stats. */ #define damage_chr(chr, weapon) \ - mkshort(0x0019), \ + mkshort(0x9e00), \ chr, \ HITPART_HEAD, \ weapon, \ @@ -283,7 +258,7 @@ * It's expected to be a HITPART constant. */ #define chr_damage_chr(achr, vchr, hitpart) \ - mkshort(0x001a), \ + mkshort(0x9f00), \ achr, \ vchr, \ hitpart, @@ -295,25 +270,16 @@ * The values are not known. It's only called with values 512 and 0. */ #define consider_throwing_grenade(value_1, value_2, label) \ - mkshort(0x001b), \ + mkshort(0x0c00), \ mkshort(value_1), \ mkshort(value_2), \ label, -/** - * Makes the chr spawn the given item and drop it immediately. - */ -#define drop_item(modelnum, weaponnum, label) \ - mkshort(0x001c), \ - mkshort(modelnum), \ - weaponnum, \ - label, - /** * Makes the chr jog to the given pad. This may fail if pathfinding fails. */ #define jog_to_pad(pad) \ - mkshort(0x001d), \ + mkshort(0xa000), \ mkshort(pad), /** @@ -322,21 +288,21 @@ * Speed should be GOPOSFLAG_WALK, GOPOSFLAG_JOG or GOPOSFLAG_RUN. */ #define go_to_target_pad(speed) \ - mkshort(0x001e), \ + mkshort(0xa100), \ speed, /** * Makes the chr walk to the given pad. This may fail if pathfinding fails. */ #define walk_to_pad(pad) \ - mkshort(0x001f), \ + mkshort(0xa200), \ mkshort(pad), /** * Makes the chr run to the given pad. This may fail if pathfinding fails. */ #define run_to_pad(pad) \ - mkshort(0x0020), \ + mkshort(0xa300), \ mkshort(pad), /** @@ -344,57 +310,42 @@ * patrolling until start_patrol is used. */ #define assign_path(pathid) \ - mkshort(0x0021), \ + mkshort(0xff07), \ pathid, /** * Makes the chr start patrolling. */ #define start_patrol \ - mkshort(0x0022), + mkshort(0xff08), /** * Checks if the chr is patrolling. */ #define if_patrolling(label) \ - mkshort(0x0023), \ + mkshort(0x0d00), \ label, /** * Makes the chr surrender. */ #define surrender \ - mkshort(0x0024), + mkshort(0xff09), /** * Makes the chr drop their gun and fade out. For an immersive gameplay * experience, don't do this when the chr is on screen. */ #define drop_gun_and_fade_out \ - mkshort(0x0025), + mkshort(0xa400), /** * Remove the chr completely. */ #define remove_chr(chr) \ - mkshort(0x0026), \ + mkshort(0xa500), \ chr, -/** - * Makes the chr try to run to an alarm switch and activate it. - * - * The pad argument should be the pad that the alarm is at. A check is done to - * make sure the object at that pad is healthy. - * - * Note that no check is done to make sure that the object at the pad is - * actually an alarm switch, and the chr will actually run to their closest - * alarm switch rather than the one at the given pad. - */ -#define try_start_alarm(pad, label) \ - mkshort(0x0027), \ - mkshort(pad), \ - label, - /** * Activates the alarm. This alone does nothing except make the alarm sound * start. To make guards spawn when the alarm is sounded, an AI list must wait @@ -404,29 +355,20 @@ * 55 seconds. */ #define activate_alarm \ - mkshort(0x0028), + mkshort(0xa600), /** * Deactivates the alarm. */ #define deactivate_alarm \ - mkshort(0x0029), - -/** - * Makes the chr attempt to run 1000 units in the opposite direction to their - * target, without any pathfinding. If this destination is obstructed by a wall - * then they'll run as far as they can and stop at the wall. - */ -#define try_run_from_target(label) \ - mkshort(0x002a), \ - label, + mkshort(0xa700), /** * Makes the chr attempt to jog to their target. The target can be a chr, object * or the player. */ #define try_jog_to_target(label) \ - mkshort(0x002b), \ + mkshort(0x0e00), \ label, /** @@ -434,7 +376,7 @@ * or the player. */ #define try_walk_to_target(label) \ - mkshort(0x002c), \ + mkshort(0x0f00), \ label, /** @@ -442,31 +384,14 @@ * or the player. */ #define try_run_to_target(label) \ - mkshort(0x002d), \ - label, - -/** - * Does nothing due to a bug in the implementation. But if it worked, it would - * make the chr find a suitable prop in their current room to use as cover and - * run to it. - */ -#define try_go_to_cover_prop(label) \ - mkshort(0x002e), \ + mkshort(0x1000), \ label, /** * Makes the chr attempt to jog to the given chr. */ #define try_jog_to_chr(chr, label) \ - mkshort(0x002f), \ - chr, \ - label, - -/** - * Makes the chr attempt to walk to the given chr. - */ -#define try_walk_to_chr(chr, label) \ - mkshort(0x0030), \ + mkshort(0x1100), \ chr, \ label, @@ -474,7 +399,7 @@ * Makes the chr attempt to run to the given chr. */ #define try_run_to_chr(chr, label) \ - mkshort(0x0031), \ + mkshort(0x1200), \ chr, \ label, @@ -482,7 +407,7 @@ * Checks if the chr is doing anything, such as running or animating. */ #define if_chr_stopped(label) \ - mkshort(0x0032), \ + mkshort(0x1300), \ label, /** @@ -490,7 +415,7 @@ * animation or is invalid. */ #define if_chr_dead(chr, label) \ - mkshort(0x0033), \ + mkshort(0x1400), \ chr, \ label, @@ -498,7 +423,7 @@ * Checks if the chr has finished dying. */ #define if_chr_death_animation_finished(chr, label) \ - mkshort(0x0034), \ + mkshort(0x1500), \ chr, \ label, @@ -507,7 +432,7 @@ * object or the player. */ #define if_target_in_sight(label) \ - mkshort(0x0035), \ + mkshort(0x1600), \ label, /** @@ -515,13 +440,13 @@ * value between 0 and 255 (inclusive). */ #define call_rng \ - mkshort(0x0036), + mkshort(0xa800), /** * Checks if the chr's rand property is less than the given value. */ #define if_rand_lt(value, label) \ - mkshort(0x0037), \ + mkshort(0x1700), \ value, \ label, @@ -529,7 +454,7 @@ * Checks if the chr's rand property is greater than the given value. */ #define if_rand_gt(value, label) \ - mkshort(0x0038), \ + mkshort(0x1800), \ value, \ label, @@ -540,31 +465,21 @@ * have contained extra per-chr checks such as chr flags and distance. */ #define if_can_hear_alarm(label) \ - mkshort(0x0039), \ + mkshort(0x1900), \ label, /** * Checks if the alarm is currently sounding. */ #define if_alarm_active(label) \ - mkshort(0x003a), \ - label, - -/** - * Checks if gas has been released from a gas bottle. This is different to the - * gas that is released in Escape. - * - * Gas bottles aren't used in PD. This command is a leftover from GoldenEye. - */ -#define if_gas_active(label) \ - mkshort(0x003b), \ + mkshort(0x1a00), \ label, /** * Checks if the chr has heard their target (eg. due to gunfire). */ #define if_hears_target(label) \ - mkshort(0x003c), \ + mkshort(0x1b00), \ label, /** @@ -581,7 +496,7 @@ * |-----------|-------|-------------------------| */ #define if_saw_injury(checktype, label) \ - mkshort(0x003d), \ + mkshort(0x1c00), \ checktype, \ label, @@ -599,7 +514,7 @@ * |-----------|-------|------------------------| */ #define if_saw_death(checktype, label) \ - mkshort(0x003e), \ + mkshort(0x1d00), \ checktype, \ label, @@ -607,17 +522,7 @@ * Checks if the current chr can see their target. */ #define if_can_see_target(label) \ - mkshort(0x003f), \ - label, - -/** - * Checks if the current chr's target is in sight of the current chr, or would - * be in sight if the target were to move units left or right in a - * circle around the current chr. - */ -#define if_target_nearly_in_sight(distance, label) \ - mkshort(0x0040), \ - mkword(distance), \ + mkshort(0x1e00), \ label, /** @@ -626,31 +531,15 @@ * around their target. */ #define if_nearly_in_targets_sight(distance, label) \ - mkshort(0x0041), \ + mkshort(0x1f00), \ mkword(distance), \ label, -/** - * Checks if the current chr can see their target. If so, the chr's pad preset - * is set to a pad along the route to their target. The pad chosen is the pad - * on the route which is closest to the target and in sight of the current chr. - */ -#define set_pad_preset_to_pad_on_route_to_target(label) \ - mkshort(0x0042), \ - label, - -/** - * Checks if the chr saw their target within the last 10 seconds. - */ -#define if_saw_target_recently(label) \ - mkshort(0x0043), \ - label, - /** * Checks if the chr heard their target within the last 10 seconds. */ #define if_heard_target_recently(label) \ - mkshort(0x0044), \ + mkshort(0x2000), \ label, /** @@ -658,7 +547,7 @@ * the chr or hearing gunfire. */ #define if_detected_chr(chr, label) \ - mkshort(0x0045), \ + mkshort(0x2100), \ chr, \ label, @@ -667,7 +556,7 @@ * clones until the source chr has appeared on screen. */ #define if_never_been_onscreen(label) \ - mkshort(0x0046), \ + mkshort(0x2200), \ label, /** @@ -675,15 +564,7 @@ * either on this tick or on the prev tick. */ #define if_onscreen(label) \ - mkshort(0x0047), \ - label, - -/** - * Checks if the chr's room is onscreen. - */ -#define if_chr_in_onscreen_room(chr, label) \ - mkshort(0x0048), \ - chr, \ + mkshort(0x2300), \ label, /** @@ -693,19 +574,19 @@ * it as a pad number, and use the room that the pad is in. */ #define if_room_onscreen(room, label) \ - mkshort(0x0049), \ + mkshort(0x2400), \ mkshort(room), \ label, #define if_chr_in_view(label) \ - mkshort(0x004a), \ + mkshort(0x2500), \ label, /** * Checks if the chr had a shot nearly hit them. */ #define if_near_miss(label) \ - mkshort(0x004b), \ + mkshort(0x2600), \ label, /** @@ -717,7 +598,7 @@ * - And other unknown things */ #define if_sees_suspicious_item(label) \ - mkshort(0x004c), \ + mkshort(0x2700), \ label, /** @@ -727,7 +608,7 @@ * With angle 10, returns true if target is roughly within 12-11 o'clock. */ #define if_target_in_fov_left(angle, label) \ - mkshort(0x004d), \ + mkshort(0x2800), \ angle, \ label, @@ -755,7 +636,7 @@ * if_target_outside_my_yvisang */ #define if_fov_check_with_target(angle, op1, op2, label) \ - mkshort(0x004e), \ + mkshort(0x2900), \ angle, \ op1, \ op2, \ @@ -768,7 +649,7 @@ * if the target is roughly within 12-1 o'clock. */ #define if_target_out_of_fov_left(angle, label) \ - mkshort(0x004f), \ + mkshort(0x2a00), \ angle, \ label, @@ -777,16 +658,7 @@ * current chr's 12 o'clock (ie. either side). */ #define if_target_in_fov(angle, label) \ - mkshort(0x0050), \ - angle, \ - label, - -/** - * Similar to 004d and 004f, but checks if the target is not in front of the - * current chr by the given angle. - */ -#define if_target_out_of_fov(angle, label) \ - mkshort(0x0051), \ + mkshort(0x2b00), \ angle, \ label, @@ -795,7 +667,7 @@ * given value. */ #define if_distance_to_target_lt(distance, label) \ - mkshort(0x0052), \ + mkshort(0x2c00), \ mkshort(distance / 10), \ label, @@ -804,7 +676,7 @@ * the given value. */ #define if_distance_to_target_gt(distance, label) \ - mkshort(0x0053), \ + mkshort(0x2d00), \ mkshort(distance / 10), \ label, @@ -813,7 +685,7 @@ * given value. */ #define if_chr_distance_to_pad_lt(chr, distance, pad, label) \ - mkshort(0x0054), \ + mkshort(0x2e00), \ chr, \ mkshort(distance / 10), \ mkshort(pad), \ @@ -824,7 +696,7 @@ * the given value. */ #define if_chr_distance_to_pad_gt(chr, distance, pad, label) \ - mkshort(0x0055), \ + mkshort(0x2f00), \ chr, \ mkshort(distance / 10), \ mkshort(pad), \ @@ -835,7 +707,7 @@ * given value. */ #define if_distance_to_chr_lt(distance, chr, label) \ - mkshort(0x0056), \ + mkshort(0x3000), \ mkshort(distance / 10), \ chr, \ label, @@ -845,32 +717,17 @@ * the given value. */ #define if_distance_to_chr_gt(distance, chr, label) \ - mkshort(0x0057), \ + mkshort(0x3100), \ mkshort(distance / 10), \ chr, \ label, -#define cmd0058(distance, label) \ - mkshort(0x0058), \ - mkshort(distance / 10), \ - label, - /** * Checks if the distance from the current chr's target to the given pad is less * than the given value. The target can be another chr or an object. */ #define if_distance_from_target_to_pad_lt(distance, pad, label) \ - mkshort(0x0059), \ - mkshort(distance / 10), \ - mkshort(pad), \ - label, - -/** - * Checks if the distance from the current chr's target to the given pad is - * greater than the given value. The target can be another chr or an object. - */ -#define if_distance_from_target_to_pad_gt(distance, pad, label) \ - mkshort(0x005a), \ + mkshort(0x3200), \ mkshort(distance / 10), \ mkshort(pad), \ label, @@ -885,26 +742,17 @@ * Type 2 is hard coded to only work in G5 Building. */ #define if_chr_in_room(chr, type, room_or_pad, label) \ - mkshort(0x005b), \ + mkshort(0x3300), \ chr, \ type, \ mkshort(room_or_pad), \ label, -/** - * Checks if the chr's target is in the given room. The target can be another - * chr or object. - */ -#define if_target_in_room(room, label) \ - mkshort(0x005c), \ - mkshort(room), \ - label - /** * Checks if the given chr has the given object in their inventory. */ #define if_chr_has_object(chr, object, label) \ - mkshort(0x005d), \ + mkshort(0x3400), \ chr, \ object, \ label, @@ -913,7 +761,7 @@ * Checks if the given weapon has been thrown. */ #define if_weapon_thrown(weapon, label) \ - mkshort(0x005e), \ + mkshort(0x3500), \ weapon, \ label, @@ -922,7 +770,7 @@ * object. */ #define if_weapon_thrown_on_object(weapon, object, label) \ - mkshort(0x005f), \ + mkshort(0x3600), \ weapon, \ object, \ label, @@ -931,7 +779,7 @@ * Checks if the chr has the given weapon equipped. */ #define if_chr_weapon_equipped(chr, weapon, label) \ - mkshort(0x0060), \ + mkshort(0x3700), \ chr, \ weapon, \ label, @@ -943,7 +791,7 @@ * In practice this is always called with object = -1 and behavior = 1. */ #define if_gun_unclaimed(object, behavior, label) \ - mkshort(0x0061), \ + mkshort(0x3800), \ object, \ behavior, \ label, @@ -952,7 +800,7 @@ * Checks if the object is in good working order (ie. not destroyed). */ #define if_object_in_good_condition(object, label) \ - mkshort(0x0062), \ + mkshort(0x3900), \ object, \ label, @@ -963,52 +811,39 @@ * of this command will not pass unless the chr activates it again. */ #define if_chr_activated_object(chr, object, label) \ - mkshort(0x0063), \ + mkshort(0x3a00), \ chr, \ object, \ label, -/** - * Interacts with the given object, as if the player pressed B on it. - * - * If the object is a door, lock checks are skipped. - */ -#define obj_interact(object) \ - mkshort(0x0065), \ - object, - /** * Destroys the given object. * * In practice this is only used on mines. It might work on other objects. */ #define destroy_object(object) \ - mkshort(0x0066), \ - object, - -#define cmd0067(object) \ - mkshort(0x0067), \ + mkshort(0xa900), \ object, /** * Makes the given chr drop their concealed items. */ #define drop_concealed_items(chr) \ - mkshort(0x0068), \ + mkshort(0xaa00), \ chr, /** * Makes the given chr drop their weapon. */ #define chr_drop_weapon(chr) \ - mkshort(0x0069), \ + mkshort(0xab00), \ chr, /** * Makes the current chr give their object to the given chr. */ #define give_object_to_chr(object, chr) \ - mkshort(0x006a), \ + mkshort(0xac00), \ object, \ chr, @@ -1016,7 +851,7 @@ * Moves the object to the given pad. The move is instant. */ #define move_object_to_pad(object, pad) \ - mkshort(0x006b), \ + mkshort(0xad00), \ object, \ mkshort(pad), @@ -1024,14 +859,14 @@ * Opens the door. */ #define open_door(door) \ - mkshort(0x006c), \ + mkshort(0xae00), \ door, /** * Closes the door. */ #define close_door(door) \ - mkshort(0x006d), \ + mkshort(0xaf00), \ door, /** @@ -1042,21 +877,11 @@ * together to check multiple states at the same time. */ #define if_door_state(door, doorstate, label) \ - mkshort(0x006e), \ + mkshort(0x3b00), \ door, \ doorstate, \ label, -/** - * Checks if the given object is a door. - * - * Most likely a debug command, as you'd know what IDs your doors use. - */ -#define if_object_is_door(object, label) \ - mkshort(0x006f), \ - object, \ - label, - /** * Locks the door by applying the given bitmask to it. * @@ -1067,7 +892,7 @@ * player completes each requirement. */ #define lock_door(door, bits) \ - mkshort(0x0070), \ + mkshort(0xff0a), \ door, \ bits, @@ -1076,7 +901,7 @@ * the same bitmask that was used to lock the door) then the door is unlocked. */ #define unlock_door(door, bits) \ - mkshort(0x0071), \ + mkshort(0xb000), \ door, \ bits, @@ -1084,7 +909,7 @@ * Checks if the door is locked with the given bitmask. */ #define if_door_locked(door, bits, label) \ - mkshort(0x0072), \ + mkshort(0x3c00), \ door, \ bits, \ label, @@ -1096,7 +921,7 @@ * and some objective indexes do not apply to easier difficulties. */ #define if_objective_complete(objective, label) \ - mkshort(0x0073), \ + mkshort(0x3d00), \ objective, \ label, @@ -1107,7 +932,7 @@ * and some objective indexes do not apply to easier difficulties. */ #define if_objective_failed(objective, label) \ - mkshort(0x0074), \ + mkshort(0x3e00), \ objective, \ label, @@ -1118,7 +943,7 @@ * If u1 were 0x10 or 0x20, some other logic would be used. */ #define try_set_target_pad_to_something(u1, label) \ - mkshort(0x0075), \ + mkshort(0x3f00), \ u1, \ label, @@ -1136,7 +961,7 @@ * No further checks are done. */ #define try_set_padpreset_to_target_quadrant(quadrant, label) \ - mkshort(0x0076), \ + mkshort(0x4000), \ quadrant, \ label, @@ -1146,7 +971,7 @@ * Diff is expected to be one of DIFF_A, DIFF_SA, DIFF_PA or DIFF_PD. */ #define if_difficulty_lt(diff, label) \ - mkshort(0x0077), \ + mkshort(0x4100), \ diff, \ label, @@ -1156,43 +981,17 @@ * Diff is expected to be one of DIFF_A, DIFF_SA, DIFF_PA or DIFF_PD. */ #define if_difficulty_gt(diff, label) \ - mkshort(0x0078), \ + mkshort(0x4200), \ diff, \ label, -/** - * Checks if the stage timer is less than the given number of seconds. - */ -#define if_stage_timer_lt(seconds, label) \ - mkshort(0x0079), \ - mkshort(seconds), \ - label, - -/** - * Checks if the stage timer is greater than the given number of seconds. - */ -#define if_stage_timer_gt(seconds, label) \ - mkshort(0x007a), \ - mkshort(seconds), \ - label, - /** * Checks if the stage ID is less than the given value. * * Consider using the helper macro if_stage_is_not instead. */ -#define if_stage_lt(stage, label) \ - mkshort(0x007b), \ - stage, \ - label, - -/** - * Checks if the stage ID is greater than the given value. - * - * Consider using the helper macro if_stage_is_not instead. - */ -#define if_stage_gt(stage, label) \ - mkshort(0x007c), \ +#define if_stage_is_not(stage, label) \ + mkshort(0x4300), \ stage, \ label, @@ -1200,7 +999,7 @@ * Checks if the chr has been shot less than the given number of times. */ #define if_num_times_shot_lt(value, label) \ - mkshort(0x007d), \ + mkshort(0x4400), \ value, \ label, @@ -1208,44 +1007,10 @@ * Checks if the chr has been shot more than the given number of times. */ #define if_num_times_shot_gt(value, label) \ - mkshort(0x007e), \ + mkshort(0x4500), \ value, \ label, -/** - * Checks if the chr has had less than the given number of near misses. - */ -#define if_num_close_arghs_lt(value, label) \ - mkshort(0x007f), \ - value, \ - label, - -/** - * Checks if the chr has had more than the given number of near misses. - */ -#define if_num_close_arghs_gt(value, label) \ - mkshort(0x0080), \ - value, \ - label, - -/** - * Checks if the chr's health is greater than the given value. - */ -#define if_chr_health_gt(chr, health, label) \ - mkshort(0x0081), \ - chr, \ - health, \ - label, - -/** - * Checks if the chr's health is less than the given value. - */ -#define if_chr_health_lt(chr, health, label) \ - mkshort(0x0082), \ - chr, \ - health, \ - label, - /** * Checks if the chr was just injured. * @@ -1261,7 +1026,7 @@ * unless the chr is injured again. */ #define if_just_injured(chr, label) \ - mkshort(0x0083), \ + mkshort(0x4600), \ chr, \ label, @@ -1272,74 +1037,51 @@ * The value range is 0-255. */ #define set_morale(value) \ - mkshort(0x0084), \ + mkshort(0xb100), \ value, /** * Adds the given value to the current chr's morale property. */ #define add_morale(value) \ - mkshort(0x0085), \ - value, - -/** - * Adds the given value to the given chr's morale property. - */ -#define chr_add_morale(chr, value) \ - mkshort(0x0086), \ - chr, \ + mkshort(0xb200), \ value, /** * Subtracts the given value from the current chr's morale property. */ #define subtract_morale(value) \ - mkshort(0x0087), \ + mkshort(0xb300), \ value, /** * Checks if the chr's morale property is less than the given value. */ #define if_morale_lt(value, label) \ - mkshort(0x0088), \ + mkshort(0x4700), \ value, \ label, -/** - * Checks if the chr's morale property is less than the chr's rand property. - */ -#define if_morale_lt_random(label) \ - mkshort(0x0089), \ - label, - /** * Sets the chr's alertness value. Alertness of 100 or more causes them to * respond. */ #define set_alertness(value) \ - mkshort(0x008a), \ + mkshort(0xb400), \ value, /** * Adds the given value to the current chr's alertness. */ #define increase_self_alertness(value) \ - mkshort(0x008b), \ + mkshort(0xb500), \ value, /** * Adds the given value to the given chr's alertness. */ #define increase_chr_alertness(value, chr) \ - mkshort(0x008c), \ - value, \ - chr, - -/** - * Subtracts the given value from current chr's alertness. - */ -#define subtract_alertness(value, chr) \ - mkshort(0x008d), \ + mkshort(0xb600), \ value, \ chr, @@ -1349,7 +1091,7 @@ * Operator is expected to be OPERATOR_LESS_THAN or OPERATOR_GREATER_THAN. */ #define if_alertness(value, operator, label) \ - mkshort(0x008e), \ + mkshort(0x4800), \ value, \ operator, \ label, @@ -1358,35 +1100,25 @@ * Checks if the given chr's alertness is less than the given value. */ #define if_chr_alertness_lt(value, chr, label) \ - mkshort(0x008f), \ + mkshort(0x4900), \ value, \ chr, \ label, -/** - * Checks if the current chr's alertness is less than their rand property. - */ -#define if_alertness_lt_random(label) \ - mkshort(0x0090), \ - label, - -#define noop0091 \ - mkshort(0x0091), - /** * Set the current chr's hear distance. * * This value might be multiplied or divided by 1000. */ #define set_hear_distance(value) \ - mkshort(0x0092), \ + mkshort(0xb700), \ mkshort(value), /** * Set the current chr's view distance. */ #define set_view_distance(value) \ - mkshort(0x0093), \ + mkshort(0xb800), \ value, /** @@ -1394,14 +1126,14 @@ * consider_throwing_grenade command. */ #define set_grenade_probability_out_of_255(value) \ - mkshort(0x0094), \ + mkshort(0xff0b), \ value, /** * Assigns a new ID to the chr. */ #define set_chr_id(newid) \ - mkshort(0x0095), \ + mkshort(0xff0c), \ newid, /** @@ -1412,7 +1144,7 @@ * be assigned to the object itself. */ #define set_chr_maxdamage(chr, value) \ - mkshort(0x0096), \ + mkshort(0xff0d), \ chr, \ mkshort(value), @@ -1428,21 +1160,21 @@ * may become negative, which has the effect of having body armor. */ #define add_health_or_armor(value) \ - mkshort(0x0097), \ + mkshort(0xff0e), \ mkshort(value), /** * Set the chr's reaction speed. Range is probably -128 to 127. */ #define set_reaction_speed(value) \ - mkshort(0x0098), \ + mkshort(0xff0f), \ value, /** * Set the chr's injury recovery speed. Range is probably -128 to 127. */ #define set_recovery_speed(value) \ - mkshort(0x0099), \ + mkshort(0xff10), \ value, /** @@ -1454,7 +1186,7 @@ * This setting has no effect if the chr has CHRHFLAG_PERFECTACCURACY. */ #define set_accuracy(value) \ - mkshort(0x009a), \ + mkshort(0xff11), \ value, /** @@ -1464,7 +1196,7 @@ * Use BANK_1 and a CHRFLAG1 constant for chr->flags2 (chr struct offset 0x118). */ #define set_self_flag_bankx(flag, bank) \ - mkshort(0x009b), \ + mkshort(0xb900), \ mkword(flag), \ bank, @@ -1474,7 +1206,7 @@ * See set_self_flag_bankx for more info. */ #define unset_self_flag_bankx(flag, bank) \ - mkshort(0x009c), \ + mkshort(0xba00), \ mkword(flag), \ bank, @@ -1487,7 +1219,7 @@ * See set_self_flag_bankx for more info. */ #define if_self_flag_bankx_eq(flag, bool, bank, label) \ - mkshort(0x009d), \ + mkshort(0x4a00), \ mkword(flag), \ bool, \ bank, \ @@ -1499,7 +1231,7 @@ * See set_self_flag_bankx for more info. */ #define set_chr_flag_bankx(chr, props, bank) \ - mkshort(0x009e), \ + mkshort(0xbb00), \ chr, \ mkword(props), \ bank, @@ -1510,7 +1242,7 @@ * See set_self_flag_bankx for more info. */ #define unset_chr_flag_bankx(chr, flag, bank) \ - mkshort(0x009f), \ + mkshort(0xbc00), \ chr, \ mkword(flag), \ bank, @@ -1521,7 +1253,7 @@ * See set_self_flag_bankx for more info. */ #define if_chr_has_flag_bankx(chr, flag, bank, label) \ - mkshort(0x00a0), \ + mkshort(0x4b00), \ chr, \ mkword(flag), \ bank, \ @@ -1536,7 +1268,7 @@ * stage flag is set. */ #define set_stage_flag(stageflag) \ - mkshort(0x00a1), \ + mkshort(0xbd00), \ mkword(stageflag), /** @@ -1546,7 +1278,7 @@ * incomplete. */ #define unset_stage_flag(stageflag) \ - mkshort(0x00a2), \ + mkshort(0xbe00), \ mkword(stageflag), /** @@ -1555,7 +1287,7 @@ * Set bool to TRUE if checking if set, or FALSE if checking if unset. */ #define if_stage_flag_eq(stageflag, bool, label) \ - mkshort(0x00a3), \ + mkshort(0x4c00), \ mkword(stageflag), \ bool, \ label, @@ -1566,7 +1298,7 @@ * Expects a CHRCFLAG constant. */ #define set_self_chrflag(chrflag3) \ - mkshort(0x00a4), \ + mkshort(0xbf00), \ mkword(chrflag3), /** @@ -1575,7 +1307,7 @@ * See set_self_chrflag for more info. */ #define unset_self_chrflag(chrflag3) \ - mkshort(0x00a5), \ + mkshort(0xc000), \ mkword(chrflag3), /** @@ -1584,7 +1316,7 @@ * See set_self_chrflag for more info. */ #define if_self_has_chrflag(chrflag3, label) \ - mkshort(0x00a6), \ + mkshort(0x4d00), \ mkword(chrflag3), \ label, @@ -1594,7 +1326,7 @@ * See set_self_chrflag for more info. */ #define set_chr_chrflag(chr, chrflag3) \ - mkshort(0x00a7), \ + mkshort(0xc100), \ chr, \ mkword(chrflag3), @@ -1604,7 +1336,7 @@ * See set_self_chrflag for more info. */ #define unset_chr_chrflag(chr, chrflag3) \ - mkshort(0x00a8), \ + mkshort(0xc200), \ chr, \ mkword(chrflag3), @@ -1614,7 +1346,7 @@ * See set_self_chrflag for more info. */ #define if_chr_has_chrflag(chr, chrflag3, label) \ - mkshort(0x00a9), \ + mkshort(0x4e00), \ chr, \ mkword(chrflag3), \ label, @@ -1625,7 +1357,7 @@ * Expects an OBJFLAG constant. */ #define set_object_flag(object, objectflag) \ - mkshort(0x00aa), \ + mkshort(0xc300), \ object, \ mkword(objectflag), @@ -1635,28 +1367,17 @@ * See set_object_flag for more info. */ #define unset_object_flag(object, objectflag) \ - mkshort(0x00ab), \ + mkshort(0xc400), \ object, \ mkword(objectflag), -/** - * Checks if the given object has the given flags property. - * - * See set_object_flag for more info. - */ -#define if_object_has_flag(object, objectflag, label) \ - mkshort(0x00ac), \ - object, \ - mkword(objectflag), \ - label, - /** * Sets a flag on the object's flags2 property (object struct offset 0x0c). * * Expects an OBJFLAG2 constant. */ #define set_object_flag2(object, objectflag2) \ - mkshort(0x00ad), \ + mkshort(0xc500), \ object, \ mkword(objectflag2), @@ -1666,7 +1387,7 @@ * See set_object_flag2 for more info. */ #define unset_object_flag2(object, objectflag2) \ - mkshort(0x00ae), \ + mkshort(0xc600), \ object, \ mkword(objectflag2), @@ -1676,7 +1397,7 @@ * See set_object_flag2 for more info. */ #define if_object_flag2(object, objectflag2, label) \ - mkshort(0x00af), \ + mkshort(0x4f00), \ object, \ mkword(objectflag2), \ label, @@ -1687,7 +1408,7 @@ * chrpreset is a general purpose property. It can be referenced via CHR_PRESET. */ #define set_chrpreset(chr) \ - mkshort(0x00b0), \ + mkshort(0xc700), \ chr, /** @@ -1697,7 +1418,7 @@ * CHR_TARGET. */ #define set_chr_target_chr(chr, target) \ - mkshort(0x00b1), \ + mkshort(0xc800), \ chr, \ target, @@ -1707,73 +1428,39 @@ * padpreset can be referenced via PAD_PRESET. */ #define set_padpreset(pad) \ - mkshort(0x00b2), \ + mkshort(0xc900), \ mkshort(pad), -/** - * Sets the given chr's padpreset property. - * - * padpreset can be referenced via PAD_PRESET. - */ -#define chr_set_target_pad(chr, pad) \ - mkshort(0x00b3), \ - chr, \ - mkshort(pad), - -/** - * Copies the padpreset from the source chr to the destination chr. - */ -#define chr_copy_target_pad(srcchr, dstchr) \ - mkshort(0x00b4), \ - srcchr, \ - dstchr, - /** * Resets the current chr's timer to zero and starts it. */ #define restart_timer \ - mkshort(0x00b6), + mkshort(0xca00), /** * Resets the current chr's timer to zero. The running state is unchanged. */ #define reset_timer \ - mkshort(0x00b7), + mkshort(0xcb00), /** * Pauses the current chr's timer. The timer value is unchanged. */ #define pause_timer \ - mkshort(0x00b8), + mkshort(0xcc00), /** * Resumes the current chr's timer. The timer continues from where it left off * previously. */ #define resume_timer \ - mkshort(0x00b9), - -/** - * Checks if the current chr's timer is stopped. - */ -#define if_timer_stopped(label) \ - mkshort(0x00ba), \ - label, - -/** - * Checks if the current chr's timer value is greater than the chr's rand value. - * - * You need to use call_rng before using this. - */ -#define if_timer_gt_random(label) \ - mkshort(0x00bb), \ - label, + mkshort(0xcd00), /** * Checks if the current chr's timer value is greater than the given value. */ #define if_timer_gt(value, label) \ - mkshort(0x00bd), \ + mkshort(0x5100), \ 0x00, \ mkshort(value), \ label, @@ -1782,7 +1469,7 @@ * Checks if the current chr's timer value is less than the given value. */ #define if_timer_lt(value, label) \ - mkshort(0x00bc), \ + mkshort(0x5000), \ 0x00, \ mkshort(value), \ label, @@ -1791,45 +1478,38 @@ * Shows the countdown timer. */ #define show_countdown_timer \ - mkshort(0x00be), + mkshort(0xff12), /** * Hides the countdown timer. */ #define hide_countdown_timer \ - mkshort(0x00bf), + mkshort(0xff13), /** * Sets the countdown timer value. */ #define set_countdown_timer(seconds) \ - mkshort(0x00c0), \ + mkshort(0xff14), \ mkshort(seconds), /** * Stops the countdown timer. */ #define stop_countdown_timer \ - mkshort(0x00c1), + mkshort(0xff15), /** * Starts the countdown timer. */ #define start_countdown_timer \ - mkshort(0x00c2), - -/** - * Checks if the countdown timer is stopped. - */ -#define if_countdown_timer_stopped(label) \ - mkshort(0x00c3), \ - label, + mkshort(0xff16), /** * Checks if the countdown timer value is less than the given value. */ #define if_countdown_timer_lt(value, label) \ - mkshort(0x00c4), \ + mkshort(0x5200), \ mkshort(value), \ label, @@ -1837,7 +1517,7 @@ * Checks if the countdown timer value is greater than the given value. */ #define if_countdown_timer_gt(value, label) \ - mkshort(0x00c5), \ + mkshort(0x5300), \ mkshort(value), \ label, @@ -1845,7 +1525,7 @@ * Attempts to spawn a chr at the given pad. */ #define try_spawn_chr_at_pad(body, head, pad, ailist, spawnflags, label) \ - mkshort(0x00c6), \ + mkshort(0x5400), \ body, \ head, \ mkshort(pad), \ @@ -1857,7 +1537,7 @@ * Attempts to spawn a chr at the given chr. */ #define try_spawn_chr_at_chr(body, head, chrnum, ailist, spawnflags, label) \ - mkshort(0x00c7), \ + mkshort(0x5500), \ body, \ head, \ chrnum, \ @@ -1871,25 +1551,14 @@ * Will cause crashes if the weapon's model file lacks positional information. */ #define try_equip_weapon(model, weapon, flags, label) \ - mkshort(0x00c8), \ + mkshort(0x5600), \ mkshort(model), \ weapon, \ mkword(flags), \ label, -/** - * Makes the chr equip the given model as a hat. - * - * Will cause crashes if the model file lacks positional information. - */ -#define try_equip_hat(model, flags, label) \ - mkshort(0x00c9), \ - mkshort(model), \ - mkword(flags), \ - label, - #define try_spawn_clone2(chr, ailist, spawnflags, label) \ - mkshort(0x00ca), \ + mkshort(0x5700), \ chr, \ mkshort(ailist), \ mkword(spawnflags), \ @@ -1901,7 +1570,7 @@ * The chr argument should be a player. */ #define show_hudmsg(chr, text) \ - mkshort(0x00cb), \ + mkshort(0xce00), \ chr, \ mkshort(text), @@ -1912,7 +1581,7 @@ * The color argument should be a COLOR constant. */ #define show_hudmsg_top_middle(chr, text, color) \ - mkshort(0x00cc), \ + mkshort(0xcf00), \ chr, \ mkshort(text), \ color, @@ -1925,7 +1594,7 @@ * The color argument should be a COLOR constant. */ #define speak(chr, text, sound, channel, color) \ - mkshort(0x00cd), \ + mkshort(0xd000), \ chr, \ mkshort(text), \ mkshort(sound), \ @@ -1938,7 +1607,7 @@ * The channel argument should be a CHANNEL constant. */ #define play_sound(id, channel) \ - mkshort(0x00ce), \ + mkshort(0xd100), \ mkshort(id), \ channel, @@ -1949,7 +1618,7 @@ * The bool argument should be TRUE to play or FALSE to stop. */ #define control_sound_from_object(channel, object, bool) \ - mkshort(0x00cf), \ + mkshort(0xd200), \ channel, \ object, \ 0x00, \ @@ -1959,43 +1628,25 @@ * Plays a sound coming from the given pad. */ #define play_sound_from_pad(pad, sound) \ - mkshort(0x00d0), \ + mkshort(0xff17), \ 0x00, \ mkshort(pad), \ mkshort(sound), -#define cmd00d1(channel, audio_id, u1) \ - mkshort(0x00d1), \ - channel, \ - mkshort(audio_id), \ - mkshort(u1), - -#define cmd00d2(channel, audio_id, u1) \ - mkshort(0x00d2), \ - channel, \ - mkshort(audio_id), \ - mkshort(u1), - /** * Stops the given audio channel. * * The channel argument should be a CHANNEL constant. */ #define mute_channel(channel) \ - mkshort(0x00d3), \ + mkshort(0xd300), \ channel, -#define cmd00d4(channel, u2, label) \ - mkshort(0x00d4), \ - channel, \ - mkshort(u2), \ - label, - /** * Assigns a path to a hovercar and makes it start it. */ #define begin_hovercar_path(path) \ - mkshort(0x00d5), \ + mkshort(0xff18), \ path, /** @@ -2007,7 +1658,7 @@ * new speed, assuming 60 frames per second. */ #define set_vehicle_speed(speed, num_accel_frames) \ - mkshort(0x00d6), \ + mkshort(0xff19), \ mkshort(speed), \ mkshort(num_accel_frames), @@ -2018,18 +1669,10 @@ * The units for this aren't known. */ #define set_rotor_speed(speed, time) \ - mkshort(0x00d7), \ + mkshort(0xff1a), \ mkshort(speed), \ mkshort(time), -#define noop00d8(u1) \ - mkshort(0x00d8), \ - u1, - -#define noop00d9(u1) \ - mkshort(0x00d9), \ - u1, - /** * Sets the image for a monitor object. * @@ -2037,43 +1680,33 @@ * For multi screen objects, slot can be 0-3. */ #define set_object_image(object, slot, image) \ - mkshort(0x00da), \ + mkshort(0xd400), \ object, \ slot, \ image, -#define noop00db(u1) \ - mkshort(0x00db), \ - u1, - /** * End the current level immediately. * * If all objectives are complete then the endscreen will be completed. */ #define end_level \ - mkshort(0x00dc), + mkshort(0xff1b), #define enter_firstperson \ - mkshort(0x00dd), + mkshort(0xff1c), #define enter_camera_and_move_to_pad(pad) \ - mkshort(0x00de), \ + mkshort(0xff1d), \ mkshort(pad), -#define cmd00df(object, u1, u2) \ - mkshort(0x00df), \ - object, \ - mkshort(u1), \ - mkshort(u2), - /** * Remove control from the given chr. * * Used for the auto walk sequences in Extraction and Duel. */ #define revoke_control(chr, value) \ - mkshort(0x00e0), \ + mkshort(0xff1e), \ chr, \ value, @@ -2081,7 +1714,7 @@ * Grant control back to the given chr. */ #define grant_control(chr) \ - mkshort(0x00e1), \ + mkshort(0xff1f), \ chr, /** @@ -2101,43 +1734,25 @@ * warp a co-op AI buddy to the player when using the stealth command. */ #define chr_move_to_pad(chr, pad, allowonscreen, label) \ - mkshort(0x00e2), \ + mkshort(0x5800), \ chr, \ mkshort(pad), \ allowonscreen, \ label, -#define cmd00e3(chr) \ - mkshort(0x00e3), \ - chr, - -#define cmd00e4(u1) \ - mkshort(0x00e4), \ - u1, - -#define if_colour_fade_complete(chr, label) \ - mkshort(0x00e5), \ - chr, \ - label, - /** * Set the door's state to be fully open. There is no transition; the state is * applied instantly. */ #define set_door_open(door) \ - mkshort(0x00e8), \ + mkshort(0xd500), \ door, -#define cmd00e9(chr, u1) \ - mkshort(0x00e9), \ - chr, \ - u1, - /** * Checks if the number of players is less than the given value. */ #define if_num_human_players_lt(value, label) \ - mkshort(0x00ea), \ + mkshort(0x5900), \ value, \ label, @@ -2147,7 +1762,7 @@ * Ammotype is expected to be an AMMOTYPE constant. */ #define if_ammo_quantity_lt(chr, ammotype, value, label) \ - mkshort(0x00eb), \ + mkshort(0x5a00), \ chr, \ ammotype, \ value, \ @@ -2157,7 +1772,7 @@ * Makes the player equip the given weapon. */ #define chr_draw_weapon(chr, weapon) \ - mkshort(0x00ec), \ + mkshort(0xd600), \ chr, \ weapon, @@ -2165,82 +1780,31 @@ * Makes the player equip the given weapon (for cutscene use). */ #define chr_draw_weapon_in_cutscene(chr, weapon) \ - mkshort(0x00ed), \ + mkshort(0xff20), \ chr, \ weapon, -#define cmd00ee(chr, x, z) \ - mkshort(0x00ee), \ - x, \ - z, - /** * Checks if the given object is in the given room. */ #define if_object_in_room(object, room, label) \ - mkshort(0x00ef), \ + mkshort(0x5b00), \ object, \ mkshort(room), \ label, -#define cmd00f0(label) \ - mkshort(0x00f0), \ - label, - -/** - * Checks if the current chr is attacking. - */ -#define if_attacking(label) \ - mkshort(0x00f1), \ - label, - -/** - * Switch to the stage's alternative sky/fog settings. The switch is instant. - * - * The stage must use a type 1 sky (in the g_EnvironmentsType1 table) and the - * alternative sky must be placed immediately after it. - */ -#define switch_to_alt_sky \ - mkshort(0x00f2), - /** * Makes the given player invincible. */ #define set_invincible(chr) \ - mkshort(0x00f3), \ + mkshort(0xff21), \ chr, -#define cmd00f4(u1, u2, u3, u4, u5, u6) \ - mkshort(0x00f4), \ - mkshort(u1), \ - mkshort(u2), \ - mkshort(u3), \ - mkshort(u4), \ - mkshort(u5), \ - mkshort(u6), - -#define cmd00f5 \ - mkshort(0x00f5), - -#define cmd00f6(label) \ - mkshort(0x00f6), \ - label, - /** * Checks if all objectives are complete. */ #define if_all_objectives_complete(label) \ - mkshort(0x00f7), \ - label, - -/** - * Checks if the player is invincible. - * - * See set_invincible. - */ -#define if_player_is_invincible(chr, label) \ - mkshort(0x00f8), \ - chr, \ + mkshort(0x5c00), \ label, /** @@ -2258,7 +1822,7 @@ * Once maxsecs is reached the track is stopped regardless. */ #define play_x_track(xreason, minsecs, maxsecs) \ - mkshort(0x00f9), \ + mkshort(0xff22), \ xreason, \ minsecs, \ maxsecs, @@ -2273,14 +1837,14 @@ * reason. */ #define stop_x_track(xreason) \ - mkshort(0x00fa), \ + mkshort(0xff23), \ xreason, /** * Surround the given player in infinite explosions. */ #define explosions_around_chr(chr) \ - mkshort(0x00fb), \ + mkshort(0xff24), \ chr, /** @@ -2291,43 +1855,12 @@ * Skedar in Attack Ship. */ #define if_kill_count_gt(value, label) \ - mkshort(0x00fc), \ + mkshort(0x5d00), \ value, \ label, -#define cmd00fd(chr, label) \ - mkshort(0x00fd), \ - chr, \ - label, - -/** - * Kill Bond/Joanna immediately. - */ -#define kill_bond \ - mkshort(0x00fe), - -/** - * Makes the chr raise their hands in a surrendering pose. - * - * This should not be used to make a chr surrender. Use the `surrender` command - * instead. - * - * This command isn't used. The "surprised" part of the name is there because - * this is internally implemented using the ACT_SURPRISED action. - */ -#define be_surprised_surrender \ - mkshort(0x00ff), - -#define cmd0100_noop(u1) \ - mkshort(0x0100), \ - u1, - -#define cmd0101_noop(u1) \ - mkshort(0x0101), \ - u1, - #define set_lights_state(pad, operation, u1, u2, u3) \ - mkshort(0x0102), \ + mkshort(0xff25), \ mkshort(pad), \ operation, \ u1, \ @@ -2337,33 +1870,6 @@ 0x00, \ 0x00, -/** - * Checks if the current chr's proppreset is blocking line of sight from the chr - * to their target. - */ -#define if_proppreset_blocking_sight_to_target(label) \ - mkshort(0x0103), \ - label, - -/** - * Removes a prop (chr or object) from the stage. The prop is the one referenced - * by the current chr's proppreset property. - */ -#define remove_object_at_proppreset \ - mkshort(0x0104), - -/** - * Checks if the height (bounding box height, not Y value) of the current chr's - * proppreset is less than the given value. - * - * If the prop is invalid, the computed height will be zero which causes the - * check to pass. - */ -#define if_proppreset_height_lt(height, label) \ - mkshort(0x0105), \ - mkshort(height), \ - label, - /** * Set the current chr's target to the given chr. * @@ -2371,7 +1877,7 @@ * not currently supported by the decomp project. */ #define set_target_chr(chr) \ - mkshort(0x0106), \ + mkshort(0xd700), \ chr, \ 0x00, \ 0x00, @@ -2384,7 +1890,7 @@ * prevent both chrs from attacking the same enemy. */ #define if_chrpresets_target_is_different(label) \ - mkshort(0x0107), \ + mkshort(0x5e00), \ label, /** @@ -2392,39 +1898,12 @@ * If anytarget is true, check if chr1 has any target at all. */ #define if_chr_target_eq(chr1, chr2, anytarget, label) \ - mkshort(0x0108), \ + mkshort(0x5f00), \ chr1, \ chr2, \ anytarget, \ label, -/** - * Check all chrs within the given distance of the current chr. If any chr - * passes a team check (as given by checktype), set the current chr's chrpreset - * to that chr and follow the label. - * - * Checktype can be COMPARE_FRIENDS, COMPARE_ENEMIES or COMPANY_ANY. - */ -#define set_chrpreset_to_chr_near_self(checktype, distance, label) \ - mkshort(0x0109), \ - checktype, \ - mkshort(distance), \ - label, \ - -/** - * Check all chrs within the given distance of the given pad. If any chr passes - * a team check (as given by checktype), set the current chr's chrpreset to that - * chr and follow the label. - * - * Checktype can be COMPARE_FRIENDS, COMPARE_ENEMIES or COMPANY_ANY. - */ -#define set_chrpreset_to_chr_near_pad(checktype, distance, padnum, label) \ - mkshort(0x010a), \ - checktype, \ - mkshort(distance / 10), \ - mkshort(padnum), \ - label, - /** * Set the team that the chr is on. * @@ -2435,53 +1914,31 @@ * Chrs will not engage in combat with anyone who is on this team. */ #define set_chr_team(chr, team) \ - mkshort(0x010b), \ + mkshort(0xff26), \ chr, \ team, -/** - * Compares the current chr's chrpreset's team with our own. - * - * Checktype is expected to be COMPARE_FRIENDS or COMPARE_ENEMIES. - */ -#define if_compare_chrpresets_team(checktype, label) \ - mkshort(0x010c), \ - checktype, \ - label, - -#define noop010d \ - mkshort(0x010d), - /** * Set the shield amount for the current chr. */ #define set_shield(amount) \ - mkshort(0x010e), \ + mkshort(0xff27), \ mkshort(amount), /** * Checks if the chr's shield amount is less than the given value. */ #define if_chr_shield_lt(chr, value, label) \ - mkshort(0x010f), \ + mkshort(0x6000), \ chr, \ mkshort(value), \ label, -/** - * Checks if the chr's shield amount is greater than the given value. - */ -#define if_chr_shield_gt(chr, u1, label) \ - mkshort(0x0110), \ - chr, \ - mkshort(u1), \ - label, - /** * Begins a camera animation (ie. for cutscenes). */ #define camera_movement(animation) \ - mkshort(0x0111), \ + mkshort(0xff28), \ mkshort(animation), /** @@ -2496,7 +1953,7 @@ * (ie. same as 0), or -2 for the last frame. */ #define object_do_animation(animation, object, u2, startframe) \ - mkshort(0x0112), \ + mkshort(0xd800), \ mkshort(animation), \ object, \ u2, \ @@ -2506,7 +1963,7 @@ * Checks if a cutscene is still running. */ #define if_camera_animating(label) \ - mkshort(0x0113), \ + mkshort(0x6100), \ label, /** @@ -2514,7 +1971,7 @@ * considered in collision checks. */ #define enable_chr(chr) \ - mkshort(0x0114), \ + mkshort(0xd900), \ chr, /** @@ -2523,7 +1980,7 @@ * explosives, at which point they become enabled (and die) automatically. */ #define disable_chr(chr) \ - mkshort(0x0115), \ + mkshort(0xda00), \ chr, /** @@ -2531,7 +1988,7 @@ * be considered in collision checks. */ #define enable_object(object) \ - mkshort(0x0116), \ + mkshort(0xdb00), \ object, /** @@ -2539,7 +1996,7 @@ * not considered in collision checks. */ #define disable_object(object) \ - mkshort(0x0117), \ + mkshort(0xdc00), \ object, /** @@ -2548,7 +2005,7 @@ * Expects an OBJFLAG3 constant. */ #define set_object_flag3(object, objectflag3) \ - mkshort(0x0118), \ + mkshort(0xdd00), \ object, \ mkword(objectflag3), @@ -2558,7 +2015,7 @@ * See set_object_flag3 for more info. */ #define unset_object_flag3(object, objectflag3) \ - mkshort(0x0119), \ + mkshort(0xde00), \ object, \ mkword(objectflag3), @@ -2568,7 +2025,7 @@ * See set_object_flag3 for more info. */ #define if_object_flag3(object, objectflag3, label) \ - mkshort(0x011a), \ + mkshort(0x6200), \ object, \ mkword(objectflag3), \ label, @@ -2579,7 +2036,7 @@ * Expects a CHRHFLAG constant. */ #define set_chr_hiddenflag(chr, chrflag2) \ - mkshort(0x011b), \ + mkshort(0xdf00), \ chr, \ mkword(chrflag2), @@ -2589,7 +2046,7 @@ * See set_chr_hiddenflag for more info. */ #define unset_chr_hiddenflag(chr, chrflag2) \ - mkshort(0x011c), \ + mkshort(0xe000), \ chr, \ mkword(chrflag2), @@ -2599,26 +2056,16 @@ * See set_chr_hiddenflag for more info. */ #define if_chr_has_hiddenflag(chr, chrflag2, label) \ - mkshort(0x011d), \ + mkshort(0x6300), \ chr, \ mkword(chrflag2), \ label, -/** - * Checks if the given chr is human. - * - * Not sure how this handles Maians, or the female Extraction guards. - */ -#define if_chr_is_human(chr, label) \ - mkshort(0x011e), \ - chr, \ - label, - /** * Checks if the given chr is Skedar. */ #define if_chr_is_skedar(chr, label) \ - mkshort(0x011f), \ + mkshort(0x6400), \ chr, \ label, @@ -2639,7 +2086,7 @@ * weapon check. */ #define if_calculated_safety2_lt(value, label) \ - mkshort(0x0120), \ + mkshort(0x6500), \ value, \ label, @@ -2652,24 +2099,12 @@ * To actually go to the cover, go_to_cover must be used afterwards. */ #define find_cover(criteria, label) \ - mkshort(0x0121), \ + mkshort(0x6600), \ mkshort(criteria), \ label, -#define find_cover_within_dist(criteria, distance, label) \ - mkshort(0x0122), \ - mkshort(criteria), \ - mkword(distance), \ - label, - -#define find_cover_outside_dist(criteria, distance, label) \ - mkshort(0x0123), \ - mkshort(criteria), \ - mkword(distance), \ - label, - #define go_to_cover(speed) \ - mkshort(0x0124), \ + mkshort(0xe100), \ speed, /** @@ -2678,14 +2113,14 @@ * can't see the cover. */ #define check_cover_out_of_sight(label) \ - mkshort(0x0125), \ + mkshort(0x6700), \ label, /** * Checks if the player is using the CMP150 or AR34. */ #define if_player_using_cmp150_or_ar34(label) \ - mkshort(0x0126), \ + mkshort(0x6800), \ label, /** @@ -2694,7 +2129,7 @@ * A line of sight check is not used. */ #define set_target_to_enemy_on_same_floor(label) \ - mkshort(0x0127), \ + mkshort(0x6900), \ label, /** @@ -2702,29 +2137,10 @@ * chr's target chr field to that enemy. */ #define if_enemy_distance_lt_and_los(distance, label) \ - mkshort(0x0128), \ + mkshort(0x6a00), \ distance / 10, \ label, -/** - * Calculates a safety score based on several factors and compares it to the - * given value. - * - * The safety score starts at 6. - * Subtract 1 point if current chr has been shot. - * Subtract 2 points if there are no other chrs nearby. - * Subtract 1 point if there are 1 or 2 chrs nearby. - * - * So maximum safety is 6 and minimum safety is 3. - * - * See also if_calculated_safety2_lt, which is similar but includes a player - * weapon check. - */ -#define if_calculated_safety_lt(score, label) \ - mkshort(0x0129), \ - score, \ - label, - /** * Checks if the distance change from the current chr to the chr's target has * not changed by more than 50 units since 1 second ago. In other words, if the @@ -2737,7 +2153,7 @@ * If chr is non-zero, compare the given chr and their target. */ #define if_target_moving_slowly(chr, label) \ - mkshort(0x012a), \ + mkshort(0x6b00), \ chr, \ label, @@ -2746,7 +2162,7 @@ * least 50 units in the last second. */ #define if_target_moving_closer(label) \ - mkshort(0x012b), \ + mkshort(0x6c00), \ label, /** @@ -2754,14 +2170,14 @@ * least 50 units in the last second. */ #define if_target_moving_away(label) \ - mkshort(0x012c), \ + mkshort(0x6d00), \ label, // If chr->cover > 0, call some function. // Involves some global array at 0x800a2360 // globals.c only #define cmd012f \ - mkshort(0x012f), + mkshort(0xe200), /** * Allows the current chr to say a semi-random statement from some predefined @@ -2822,7 +2238,7 @@ * the chr's current speech (if any) will be stopped. */ #define say_quip(player, quip, probability, soundgap, onlyifothers, special, textrow, colour) \ - mkshort(0x0130), \ + mkshort(0xe300), \ player, \ quip, \ probability, \ @@ -2844,7 +2260,7 @@ * The current chr's alertness will not be adjusted by this command. */ #define increase_squadron_alertness(value) \ - mkshort(0x0131), \ + mkshort(0xe400), \ value, /** @@ -2853,7 +2269,7 @@ * Action is expected to be a MA constant. */ #define set_action(action, bool) \ - mkshort(0x0132), \ + mkshort(0xe500), \ action, \ bool, @@ -2886,7 +2302,7 @@ * For all other actions it will follow if there is any eligible chr nearby. */ #define set_team_orders(orders, label) \ - mkshort(0x0133), \ + mkshort(0x6e00), \ orders, \ label, @@ -2894,7 +2310,7 @@ * Checks if the current chr's orders equal the given value. */ #define if_orders_eq(action, label) \ - mkshort(0x0134), \ + mkshort(0x6f00), \ 0xfd, \ action, \ label, @@ -2903,7 +2319,7 @@ * Checks if the current chr has orders at all. */ #define if_has_orders(label) \ - mkshort(0x0135), \ + mkshort(0x7000), \ label, /** @@ -2917,12 +2333,12 @@ * within 2314 units then runs to it. */ #define retreat(speed, operation) \ - mkshort(0x0136), \ + mkshort(0xe600), \ speed, \ operation, #define if_chr_in_squadron_doing_action(action, label) \ - mkshort(0x0137), \ + mkshort(0x7100), \ action, \ label, @@ -2933,7 +2349,7 @@ * otherwise the speech can be skipped by pausing as it starts. */ #define if_sound_finished(channel, label) \ - mkshort(0x0138), \ + mkshort(0x7200), \ channel, \ label, @@ -2945,7 +2361,7 @@ // relative to the player's direction. 335 is the same as 25 degress to the // right (360 - 25). #define cmd0139(angle, u1, bool) \ - mkshort(0x0139), \ + mkshort(0xe700), \ mkword(angle), \ u1, \ bool, @@ -2957,7 +2373,7 @@ * If distance is specified, limit search to chrs within that distance. */ #define try_set_chrpreset_to_unalerted_teammate(distance, label) \ - mkshort(0x013a), \ + mkshort(0x7300), \ distance, \ 0x00, \ label, @@ -2966,18 +2382,9 @@ * Set the current chr's squadron. */ #define set_squadron(id) \ - mkshort(0x013b), \ + mkshort(0xff29), \ id, -/** - * Makes the current chr face their cover spot. Or face away from it. Not sure. - * - * The cover spot must have been assigned to the chr already. - */ -#define face_cover(label) \ - mkshort(0x013c), \ - label, - /** * Checks if there is a live grenade or explosion nearby. If so, the position of * the object is stored in the chr's runfrompos property and the command passes. @@ -2993,7 +2400,7 @@ * Those are the only supported flags. */ #define if_dangerous_object_nearby(flags, label) \ - mkshort(0x013d), \ + mkshort(0x7400), \ flags, \ label, @@ -3001,14 +2408,7 @@ * Makes the chr run away from a live grenade. */ #define run_from_grenade \ - mkshort(0x013e), - -/** - * Checks if the current chopper's weapons are armed. - */ -#define if_chopper_weapons_armed(label) \ - mkshort(0x013f), \ - label, + mkshort(0xe800), /** * Checks if a hoverbot's next step is less than or greater than the given @@ -3017,7 +2417,7 @@ * Operator is expected to be OPERATOR_LESS_THAN or OPERATOR_GREATER_THAN. */ #define if_hoverbot_next_step(operator, step, label) \ - mkshort(0x0140), \ + mkshort(0x7500), \ operator, \ step, \ label, @@ -3029,7 +2429,7 @@ * terminals. */ #define shuffle_investigation_terminals(goodtag, badtag, pc1, pc2, pc3, pc4) \ - mkshort(0x0141), \ + mkshort(0xff2a), \ goodtag, \ badtag, \ pc1, \ @@ -3048,7 +2448,7 @@ * location, it's recommended to keep usage of this function to one stage only. */ #define set_pad_preset_to_investigation_terminal(object) \ - mkshort(0x0142), \ + mkshort(0xff2b), \ object, \ 0x00, @@ -3058,16 +2458,7 @@ * The state of the weapons can be checked with if_chopper_weapons_armed. */ #define chopper_arm_weapons \ - mkshort(0x0143), - -/** - * Sets the current chopper's weapons to unarmed. - * - * The state of the weapons can be checked with if_chopper_weapons_armed. - */ -#define chopper_unarm_weapons \ - mkshort(0x0144), \ - label, + mkshort(0xff2c), /** * Rebuilds the list of teams containing chr IDs in each team. @@ -3075,15 +2466,9 @@ * Should be used after reassigning chrs to teams. */ #define rebuild_teams \ - mkshort(0x0145), + mkshort(0xe900), -/** - * Rebuilds the list of squadrons containing chr IDs in each squadron. - * - * Should be used after reassigning chrs to squadrons. - */ -#define rebuild_squadrons \ - mkshort(0x0146), +#define rebuild_squadrons /** * Checks if all chrs in the given squadron are dead. @@ -3092,58 +2477,16 @@ * squadron is dead. */ #define if_all_chrs_in_squadron_are_dead(squadron, label) \ - mkshort(0x0147), \ + mkshort(0x7600), \ squadron, \ label, -/** - * Set the given chr to listening. - * - * The listening feature appears to be completely unused. - */ -#define chr_set_listening(chr, value) \ - mkshort(0x0148), \ - chr, \ - value, - -/** - * Checks if the given chr is listening. - * - * checktype 0 = if chr's listening value is listenvalue - * checktype 1 = if chr's convtalk value is zero - */ -#define if_chr_listening(chr, listenvalue, checktype, label) \ - mkshort(0x0149), \ - chr, \ - listenvalue, \ - checktype, \ - label, - -/** - * Always goes to label. Other arguments are unused. Probably has a purpose in - * debug. - */ -#define if_true(u1, u2, u3, label) \ - mkshort(0x014a), \ - u1, \ - u2, \ - u3, \ - label, - -/** - * Checks if the current chr is not listening (ie. not participating in a - * conversation). - */ -#define if_not_listening(label) \ - mkshort(0x014b), \ - label, - /** * Checks if the number of chrs in the given squadron is greater than the given * value. */ #define if_num_chrs_in_squadron_gt(value, squadron, label) \ - mkshort(0x0152), \ + mkshort(0x7700), \ value, \ squadron, \ label, @@ -3152,7 +2495,7 @@ * Toggles tinted glass opaqueness/transparency. */ #define set_tinted_glass_enabled(bool) \ - mkshort(0x0157), \ + mkshort(0xff2d), \ bool, /** @@ -3164,7 +2507,7 @@ * It's used to start the CI training music and the Skedar King battle music. */ #define play_track_isolated(id) \ - mkshort(0x015b), \ + mkshort(0xff2e), \ id, /** @@ -3173,7 +2516,7 @@ * It's used to restart the default CI music after a training session. */ #define play_default_tracks \ - mkshort(0x015c), + mkshort(0xff2f), /** * Checks if the chr injured their target. Use this after attacking. @@ -3181,24 +2524,17 @@ * The command will unset the flag so it may be used again. */ #define if_chr_injured_target(chr, label) \ - mkshort(0x0165), \ + mkshort(0x7800), \ chr, \ label, -/** - * Checks if the current chr's action is the given action. - */ -#define if_action_eq(action, label) \ - mkshort(0x0166), \ - label, - /** * Makes the Extraction hovercopter fire a rocket from the given side. * * Side may be 0 or 1. */ #define hovercopter_fire_rocket(side) \ - mkshort(0x0167), \ + mkshort(0xea00), \ side, /** @@ -3206,12 +2542,12 @@ * checked. */ #define if_chr_shield_damaged(chr, label) \ - mkshort(0x0168), \ + mkshort(0x7900), \ chr, \ label, #define if_chr_idle_action_eq(action, label) \ - mkshort(0x0169), \ + mkshort(0x7a00), \ action, \ label, @@ -3222,7 +2558,7 @@ * Operator is expected to be OPERATOR_LESS_THAN or OPERATOR_GREATER_THAN. */ #define if_chr_y(chr, value, operator, label) \ - mkshort(0x016a), \ + mkshort(0x7b00), \ chr, \ mkshort(value), \ operator, \ @@ -3234,21 +2570,18 @@ * Typically used to make terminals hum. */ #define play_sound_from_object(channel, object, u1, u2, u3) \ - mkshort(0x016b), \ + mkshort(0xff30), \ channel, \ object, \ mkshort(u1), \ mkshort(u2), \ mkshort(u3), -#define noop016c \ - mkshort(0x016c), - /** * Add motion blur to the player. Motion blur will wear off automatically. */ #define add_motion_blur(chr, value, bool) \ - mkshort(0x016d), \ + mkshort(0xff31), \ chr, \ value, \ bool, @@ -3263,7 +2596,7 @@ * If operation is 2, the chr is damaged and poisoned. */ #define damage_chr_by_amount(chr, amount, operation) \ - mkshort(0x016e), \ + mkshort(0xeb00), \ chr, \ amount, \ operation, @@ -3276,7 +2609,7 @@ * has been collected by the player, or if the chr has drawn a backup gun. */ #define if_has_gun(chr, label) \ - mkshort(0x016f), \ + mkshort(0x7c00), \ chr, \ 0x00, \ label, @@ -3292,7 +2625,7 @@ * instead. */ #define do_gun_command(operation, label) \ - mkshort(0x0170), \ + mkshort(0x7d00), \ operation, \ label, @@ -3301,7 +2634,7 @@ * value. */ #define if_distance_to_gun_lt(distance, label) \ - mkshort(0x0171), \ + mkshort(0x7e00), \ mkshort(distance / 10), \ label, @@ -3312,7 +2645,7 @@ * The chr argument is ignored. The command applies to the current chr. */ #define chr_recover_gun(chr, label) \ - mkshort(0x0172), \ + mkshort(0x7f00), \ chr, \ label, @@ -3322,7 +2655,7 @@ * Typically used after spawning a guard. */ #define try_inherit_properties(chr_src, label) \ - mkshort(0x0173), \ + mkshort(0x8000), \ chr_src, \ label, @@ -3333,28 +2666,28 @@ * the cutscene becomes unskippable. */ #define if_controller_button_pressed(label) \ - mkshort(0x0174), \ + mkshort(0xff00), \ label, // Used in cutscenes before giving control to Jo // Value is always 60 // Without this command, or with a 0 value, Jo faces a different direction #define cmd0175(u1) \ - mkshort(0x0175), \ + mkshort(0xec00), \ u1, /** * */ #define cmd0176_if_something(label) \ - mkshort(0x0176), \ + mkshort(0x8100), \ label, /** * Forces the player to walk to the given pad (eg. Extraction and Duel). */ #define force_walk(chr, aimpad, walkspeed, turnspeed, lookup, dist) \ - mkshort(0x0177), \ + mkshort(0xff32), \ chr, \ mkshort(aimpad), \ walkspeed, \ @@ -3366,12 +2699,12 @@ * Checks if the player's force walk has finished. */ #define if_force_walk_finished(chr, label) \ - mkshort(0x0178), \ + mkshort(0xff01), \ chr, \ label, #define play_sound_from_entity(channel, entity_id, u1, u2, attackflags) \ - mkshort(0x0179), \ + mkshort(0xed00), \ channel, \ entity_id, \ 0x00, \ @@ -3388,14 +2721,14 @@ * their normal target (same as if_can_see_target). */ #define if_can_see_attack_target(label) \ - mkshort(0x017a), \ + mkshort(0x8200), \ label, /** * Checks if the chr is knocked out or invalid. */ #define if_chr_knockedout(chr, label) \ - mkshort(0x017b), \ + mkshort(0x8300), \ chr, \ label, @@ -3403,7 +2736,7 @@ * Assigns a sound to the given channel. Does not play the sound. */ #define assign_sound(sound, channel) \ - mkshort(0x017c), \ + mkshort(0xee00), \ mkshort(sound), \ channel, @@ -3414,7 +2747,7 @@ * until stop_cutscene_track is called. */ #define play_cutscene_track(tracknum) \ - mkshort(0x017d), \ + mkshort(0xff33), \ tracknum, /** @@ -3422,7 +2755,7 @@ * stage. */ #define stop_cutscene_track \ - mkshort(0x017e), + mkshort(0xff34), /** * Overrides the ambient track temporarily to the given one and plays it. @@ -3431,7 +2764,7 @@ * outro to traffic noises. */ #define play_temporary_track(tracknum) \ - mkshort(0x017f), \ + mkshort(0xff35), \ tracknum, /** @@ -3441,13 +2774,13 @@ * ambient tracks. */ #define stop_ambient_track \ - mkshort(0x0180), + mkshort(0xff36), /** * Checks if the player is looking directly at the given object. */ #define if_chr_looking_at_object(chr, object, label) \ - mkshort(0x0181), \ + mkshort(0x8400), \ chr, \ object, \ label, @@ -3456,7 +2789,7 @@ * Makes the current chr attack their target by punching or kicking. */ #define try_punch_or_kick(label) \ - mkshort(0x0182), \ + mkshort(0x8500), \ 0x00, \ label, @@ -3464,7 +2797,7 @@ * Checks if the current chr's target is the player. */ #define if_target_is_player(label) \ - mkshort(0x0183), \ + mkshort(0x8600), \ label, /** @@ -3490,15 +2823,15 @@ * Global AI lists - with values 90,100 and 20,30 */ #define try_attack_amount(lower, upper) \ - mkshort(0x0184), \ + mkshort(0xef00), \ lower, \ upper, #define mp_init_simulants \ - mkshort(0x0185), + mkshort(0xff37), #define if_chr_soundtimer(value, operator, label) \ - mkshort(0x0186), \ + mkshort(0x8700), \ mkshort(value), \ operator, \ label, @@ -3511,43 +2844,24 @@ * be set to the player whose camspy should be checked. */ #define set_target_to_camspy_if_in_sight(label) \ - mkshort(0x0187), \ + mkshort(0x8800), \ label, /** * Checks if the lift is currently stopped. */ #define if_lift_stationary(lift, label) \ - mkshort(0x0188), \ + mkshort(0x8900), \ lift, \ label, -/** - * Makes the lift go to the given stop number. - * - * Lifts only support up to 4 stops, so stopnum must be 0-3. - */ -#define lift_go_to_stop(lift, stopnum) \ - mkshort(0x0189), \ - lift, \ - stopnum, - -/** - * Checks if the lift is stopped at the given stop number. - */ -#define if_lift_at_stop(lift, stopnum, label) \ - mkshort(0x018a), \ - lift, \ - stopnum, \ - label, - /** * Enables rain. * * The given value is not known. It may be intensity or direction. */ #define enable_rain(value) \ - mkshort(0x018b), \ + mkshort(0xff38), \ value, /** @@ -3557,7 +2871,7 @@ * modelpart should be a MODELPART constant, and refers to a node in the model. */ #define chr_toggle_modelpart(chr, modelpart) \ - mkshort(0x018c), \ + mkshort(0xff39), \ chr, \ modelpart, @@ -3567,7 +2881,7 @@ * Lifts need to be activated before they start working. */ #define activate_lift(liftid, object) \ - mkshort(0x018d), \ + mkshort(0xff3a), \ liftid, \ object, @@ -3577,7 +2891,7 @@ * Will not pass the check if the miniskedar doesn't have enough room. */ #define miniskedar_try_pounce(u1, u2, label) \ - mkshort(0x018e), \ + mkshort(0x8a00), \ u1, \ mkshort(u2), \ 0x00, \ @@ -3588,7 +2902,7 @@ * than the given value. */ #define if_object_distance_to_pad_lt(object, distance, pad, label) \ - mkshort(0x018f), \ + mkshort(0x8b00), \ object, \ mkshort(distance / 10), \ mkshort(pad), \ @@ -3600,21 +2914,21 @@ * Expected to be a GAMEFILEFLAG constant. */ #define set_savefile_flag(flag) \ - mkshort(0x0190), \ + mkshort(0xff3b), \ flag, /** * Unsets a savefile flag. */ #define unset_savefile_flag(flag) \ - mkshort(0x0191), \ + mkshort(0xff3c), \ flag, /** * Checks if the given savefile flag is set. */ #define if_savefile_flag_is_set(flag, label) \ - mkshort(0x0192), \ + mkshort(0xff02), \ flag, \ label, @@ -3622,7 +2936,7 @@ * Checks if the given savefile flag is unset. */ #define if_savefile_flag_is_unset(flag, label) \ - mkshort(0x0193), \ + mkshort(0xff03), \ flag, \ label, @@ -3630,7 +2944,7 @@ * Checks if the given object's health is less than the given value. */ #define if_object_health_lt(object, value, label) \ - mkshort(0x019e), \ + mkshort(0x8c00), \ object, \ mkshort(value), \ label, @@ -3639,7 +2953,7 @@ * Sets the given object's health. */ #define set_object_health(object, value) \ - mkshort(0x019f), \ + mkshort(0xf000), \ object, \ mkshort(value), @@ -3652,7 +2966,7 @@ * The value for specialdie should be one of the SPECIALDIE constants. */ #define set_chr_special_death_animation(chr, specialdie) \ - mkshort(0x01a0), \ + mkshort(0xf100), \ chr, \ specialdie, @@ -3661,7 +2975,7 @@ * target is in. */ #define set_chr_roomtosearch \ - mkshort(0x01a1), + mkshort(0xf200), /** * Play a quip for the CI staff. @@ -3676,7 +2990,7 @@ * The quip used is random. */ #define play_cistaff_quip(ciquip, channel) \ - mkshort(0x01a2), \ + mkshort(0xff3d), \ ciquip, \ channel, @@ -3689,7 +3003,7 @@ * See the PRESETANIM constants. */ #define do_preset_animation(value) \ - mkshort(0x01a3), \ + mkshort(0xf300), \ value, /** @@ -3702,40 +3016,19 @@ * For removing HUD messages, consider using remove_hudmsgs instead. */ #define show_hudmsg_middle(operation, color, text) \ - mkshort(0x01a4), \ + mkshort(0xf400), \ operation, \ color, \ mkshort(text), -/** - * Checks if the current chr is using a lift (most likely from the moment they - * call it until the moment the door opens at the end of the journey). - */ -#define if_using_lift(label) \ - mkshort(0x01a5), \ - label, - -/** - * Checks if the Y distance between the current chr and their target is less - * than the given value. - */ -#define if_target_y_difference_lt(distance, label) \ - mkshort(0x01a6), \ - distance / 10, \ - label - /** * Checks if the chr is not currently talking. */ #define if_chr_not_talking(chr, label) \ - mkshort(0x01a7), \ + mkshort(0x8d00), \ chr, \ label, -#define cmd01aa(label) \ - mkshort(0x01aa), \ - label, - /** * Checks if the number of knocked out chrs is less than or greater than the * given value. @@ -3743,7 +3036,7 @@ * Operator is expected to be OPERATOR_LESS_THAN or OPERATOR_GREATER_THAN. */ #define if_num_subdued(value, operator, label) \ - mkshort(0x01ab), \ + mkshort(0x8e00), \ value, \ 1 - operator, \ label, @@ -3752,21 +3045,21 @@ * Makes the player let go of the currently held object (eg. hovercrate or bed). */ #define release_grabbed_object(chr) \ - mkshort(0x01ad), \ + mkshort(0xff3e), \ chr, /** * Removes all items from the player's inventory. */ #define clear_inventory(chr) \ - mkshort(0x01ae), \ + mkshort(0xff3f), \ chr, /** * Makes the player grab the given object (eg. hovercrate or bed). */ #define grab_object(chr, object) \ - mkshort(0x01af), \ + mkshort(0xff40), \ chr, \ object, @@ -3778,7 +3071,7 @@ * The dst tags are remapped so they point at random pillars. */ #define shuffle_ruins_pillars(pdst1, pdst2, pdst3, psrc1, psrc2, psrc3, psrc4, psrc5, mdst1, mdst2, mdst3, msrc1, msrc2, msrc3, msrc4, msrc5) \ - mkshort(0x01b1), \ + mkshort(0xff41), \ pdst1, \ pdst2, \ pdst3, \ @@ -3800,7 +3093,7 @@ * Set the wind speed, which controls how quickly clouds in the sky are moving. */ #define set_wind_speed(speed) \ - mkshort(0x01b2), \ + mkshort(0xff42), \ speed, /** @@ -3812,26 +3105,18 @@ * exist. */ #define chr_toggle_p1p2(chr) \ - mkshort(0x01b3), \ + mkshort(0xf500), \ chr, #define cmd01b4_if_something(label) \ - mkshort(0x01b4), \ + mkshort(0x8f00), \ label, -/** - * Sets the given chr's p1p2 value explicitly to the given p1p2_chr. - */ -#define chr_set_p1p2(chr, p1p2_chr) \ - mkshort(0x01b5), \ - chr, \ - p1p2_chr, - /** * Enables or disables the snow effect. */ #define enable_snow(bool) \ - mkshort(0x01b6), \ + mkshort(0xff43), \ bool, /** @@ -3840,7 +3125,7 @@ * bool_unknown determines whether to call some function on the chr afterwards */ #define set_chr_cloaked(chr, bool_enable, bool_unknown) \ - mkshort(0x01b7), \ + mkshort(0xf600), \ chr, \ bool_enable, \ bool_unknown, @@ -3849,7 +3134,7 @@ * Define the team that an autogun should shoot at. */ #define set_autogun_target_team(object, team) \ - mkshort(0x01b8), \ + mkshort(0xf700), \ object, \ team, @@ -3859,7 +3144,7 @@ * Note no arguments are passed here. The switch numbers are hard coded. */ #define shuffle_pelagic_switches \ - mkshort(0x01b9), + mkshort(0xff44), /** * Makes the chr attempt to do a lying down attack. @@ -3867,25 +3152,16 @@ * attackflags is expected to be a bitfield of ATTACKFLAG constants. */ #define try_attack_lie(attackflags, entity_id, label) \ - mkshort(0x01ba), \ + mkshort(0x9000), \ mkshort(attackflags), \ mkshort(entity_id), \ label, -#define noop01bb \ - mkshort(0x01bb), \ - mkshort(0), - -#define cmd01bc(u1, label) \ - mkshort(0x01bc), \ - u1, \ - label, - /** * Checks if the CI training PC has been holographed. */ #define if_training_pc_holographed(label) \ - mkshort(0x01bd), \ + mkshort(0xff04), \ label, /** @@ -3904,7 +3180,7 @@ * WEAPON_XRAYSCANNER */ #define if_player_using_device(player, weapon, label) \ - mkshort(0x01be), \ + mkshort(0x9100), \ player, \ weapon, \ label, @@ -3916,7 +3192,7 @@ * if_teleport_full_white, then call this again with pad = 0. */ #define teleport_to_pad(pad, chr) \ - mkshort(0x01bf), \ + mkshort(0xff45), \ mkshort(pad), \ chr, @@ -3924,17 +3200,10 @@ * Checks if the teleport effect is full white. */ #define if_teleport_full_white(label, chr) \ - mkshort(0x01c0), \ + mkshort(0xff05), \ label, \ chr, -/** - * Sets the current chr's punchdodge ailist. Not sure if this used or not. - */ -#define set_aipunchdodgelist(ailistid) \ - mkshort(0x01c1), \ - mkshort(ailistid), - /** * Sets the current chr's shootingatme ailist. * @@ -3942,7 +3211,7 @@ * them. It is invoked somewhat randomly. See set_chr_dodge_rating. */ #define set_aishootingatmelist(ailistid) \ - mkshort(0x01c2), \ + mkshort(0xf800), \ mkshort(ailistid), /** @@ -3950,28 +3219,9 @@ * switched off. */ #define set_darkroomlist(ailist) \ - mkshort(0x01c3), \ + mkshort(0xf900), \ mkshort(ailist), -/** - * Sets the current chr's playerdead ailist. This is probably assigned when the - * player dies. - */ -#define set_aiplayerdeadlist(ailistid) \ - mkshort(0x01c4), \ - mkshort(ailistid), - -/** - * Makes the chr do an animation as if they are avoiding a projectile. - * - * The animation they do is selected from a group of 4 and is chosen based on - * the chr's relative angle to their target. - * - * This command is not used. - */ -#define avoid \ - mkshort(0x01c5), - /** * Sets the current chr's dodgerating and maxdodgerating properties. * @@ -3985,7 +3235,7 @@ * again. */ #define set_chr_dodge_rating(value, whichprop) \ - mkshort(0x01c6), \ + mkshort(0xff46), \ value, \ whichprop, @@ -3993,27 +3243,9 @@ * This doesn't appear to be used. */ #define set_unarmeddodgerating(value) \ - mkshort(0x01c7), \ + mkshort(0xff47), \ value, -/** - * Sets the title mode (legal, Rare logo, etc). This is an unused feature - it - * appears that at one point the title screen could be controlled via AI - * commands. - * - * Expects a TITLEAIMODE constant. - */ -#define title_init_mode(mode) \ - mkshort(0x01c8), \ - mode, - -/** - * Exits the title screen. This is an unused feature. - */ -#define try_exit_title(label) \ - mkshort(0x01c9), \ - label, - /** * Set a weapon to be used in a cutscene. * @@ -4026,7 +3258,7 @@ * a pistol, otherwise the Falcon 2 will be used. */ #define set_cutscene_weapon(chr, weapon, weapon_fallback) \ - mkshort(0x01ca), \ + mkshort(0xff48), \ chr, \ weapon, \ weapon_fallback, @@ -4042,23 +3274,16 @@ * Second with 0x00000000 (transparent) and num_frames = 90. */ #define fade_to_color(rgba, num_frames) \ - mkshort(0x01cb), \ + mkshort(0xfa00), \ mkword(rgba), \ mkshort(num_frames), -/** - * Checks if the screen fade is complete. Follows the label if complete. - */ -#define if_fade_complete(label) \ - mkshort(0x01cc), \ - label, - /** * Determines whether Jo's HUD eyepiece thing is visible when in the third * person perspective (ie. in cutscenes or when playing coop). */ #define set_chr_hudpiece_visible(chr, bool) \ - mkshort(0x01cd), \ + mkshort(0xff49), \ chr, \ bool, @@ -4068,19 +3293,19 @@ * Used in the Carrington Institute. */ #define passive_mode(bool) \ - mkshort(0x01ce), \ + mkshort(0xff4a), \ bool, /** * Makes a chr start or stop shooting in a cutscene. */ #define set_chr_shooting_in_cutscene(chr, bool) \ - mkshort(0x01cf), \ + mkshort(0xff4b), \ chr, \ bool, #define set_portal_flag(portal, flag) \ - mkshort(0x01d0), \ + mkshort(0xff4c), \ mkshort(portal), \ flag, @@ -4092,7 +3317,7 @@ * visible is a boolean. TRUE makes it visible. FALSE makes it invisible. */ #define object_set_modelpart_visible(object, modelpart, visible) \ - mkshort(0x01d1), \ + mkshort(0xff4d), \ object, \ modelpart, \ visible, @@ -4103,7 +3328,7 @@ * Used for Dr Caroll. */ #define emit_sparks(chr) \ - mkshort(0x01d2), \ + mkshort(0xfb00), \ chr, /** @@ -4118,13 +3343,13 @@ * See also DRCAROLLIMAGE constants. */ #define set_drcaroll_images(chr, left, right) \ - mkshort(0x01d3), \ + mkshort(0xff4e), \ chr, \ left, \ right, #define set_room_flag(room, flag) \ - mkshort(0x01d4), \ + mkshort(0xff4f), \ mkshort(room), \ mkshort(flag), @@ -4134,7 +3359,7 @@ * Used for cutscenes. */ #define show_nonessential_chrs(bool) \ - mkshort(0x01d5), \ + mkshort(0xff50), \ bool, /** @@ -4197,29 +3422,13 @@ * - Stops the UFO humming noise. */ #define configure_environment(room, operation, value) \ - mkshort(0x01d6), \ + mkshort(0xff51), \ mkshort(room), \ operation, \ value, -/** - * Redundant command. See if_distance_to_target_lt. - */ -#define if_distance_to_target2_lt(distance, label) \ - mkshort(0x01d7), \ - mkshort(distance / 10), \ - label, - -/** - * Redundant command. See if_distance_to_target_gt. - */ -#define if_distance_to_target2_gt(distance, label) \ - mkshort(0x01d8), \ - mkshort(distance / 10), \ - label, - #define play_sound_from_object2(channel, object, sound, u1, u2) \ - mkshort(0x01d9), \ + mkshort(0xff52), \ channel, \ object, \ mkshort(sound), \ @@ -4236,21 +3445,21 @@ * Track is expected to be a MUSIC constant. */ #define play_music_continuously(track) \ - mkshort(0x01da), \ + mkshort(0xff53), \ track, /** * Kills the given chr. */ #define kill(chr) \ - mkshort(0x01db), \ + mkshort(0xfc00), \ chr, /** * Removes the given weapon from the current player's inventory. */ #define remove_weapon_from_inventory(weapon) \ - mkshort(0x01dc), \ + mkshort(0xff54), \ weapon, /** @@ -4262,7 +3471,7 @@ * The value argument is unused. */ #define if_music_event_queue_empty(value, label) \ - mkshort(0x01dd), \ + mkshort(0xff06), \ value, \ label, @@ -4271,7 +3480,7 @@ * (ie. Y difference is less than 150). */ #define if_chr_same_floor_distance_to_pad_lt(chr, pad, distance, label) \ - mkshort(0x01df), \ + mkshort(0x9300), \ chr, \ mkshort(pad), \ mkshort(distance / 10), \ @@ -4284,7 +3493,7 @@ * if_num_human_players_lt for that. */ #define if_coop_mode(label) \ - mkshort(0x01de), \ + mkshort(0x9200), \ label, /** @@ -4297,7 +3506,7 @@ * This appears to be a debug command. It is not used normally. */ #define remove_references_to_chr \ - mkshort(0x01e0), + mkshort(0xff55), // Convenience macros for readability #define beginloop(id) \ @@ -4313,10 +3522,6 @@ #define remove_hudmsgs \ show_hudmsg_middle(0x02, 0, 0x0002) -#define if_stage_is_not(stage, label) \ - if_stage_lt(stage, label) \ - if_stage_gt(stage, label) - #define go_to_gun(label) \ do_gun_command(0, label) diff --git a/src/include/constants.h b/src/include/constants.h index c71447749..6953b6bb1 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -616,9 +616,9 @@ #define CIQUIP_ANNOYED 2 #define CIQUIP_THANKS 3 -#define CMD_LABEL 0x0002 -#define CMD_END 0x0004 -#define CMD_PRINT 0x00b5 +#define CMD_LABEL 0x9400 +#define CMD_END 0x9600 +#define CMD_GOTOFIRST 0x0100 // Collision detection #define CDRESULT_ERROR -1 diff --git a/src/lib/ailist.c b/src/lib/ailist.c index 7d90ea8b7..ca9661464 100644 --- a/src/lib/ailist.c +++ b/src/lib/ailist.c @@ -58,233 +58,368 @@ u8 *ailistFindById(s32 ailistid) return NULL; } -bool ailistIsGoto(s32 type) -{ - switch (type) { - case 0x0000: - case 0x0001: - case 0x000c: - case 0x000f: - case 0x0010: - case 0x0011: - case 0x0012: - case 0x0013: - case 0x0014: - case 0x0015: - case 0x0016: - case 0x0017: - case 0x0018: - case 0x001b: - case 0x001c: - case 0x0023: - case 0x0027: - case 0x002a: - case 0x002b: - case 0x002c: - case 0x002d: - case 0x002e: - case 0x002f: - case 0x0030: - case 0x0031: - case 0x0032: - case 0x0033: - case 0x0034: - case 0x0035: - case 0x0037: - case 0x0038: - case 0x0039: - case 0x003a: - case 0x003b: - case 0x003c: - case 0x003d: - case 0x003e: - case 0x003f: - case 0x0040: - case 0x0041: - case 0x0042: - case 0x0043: - case 0x0044: - case 0x0045: - case 0x0046: - case 0x0047: - case 0x0048: - case 0x0049: - case 0x004a: - case 0x004b: - case 0x004c: - case 0x004d: - case 0x004e: - case 0x004f: - case 0x0050: - case 0x0051: - case 0x0052: - case 0x0053: - case 0x0054: - case 0x0055: - case 0x0056: - case 0x0057: - case 0x0058: - case 0x0059: - case 0x005a: - case 0x005b: - case 0x005c: - case 0x005d: - case 0x005e: - case 0x005f: - case 0x0060: - case 0x0061: - case 0x0062: - case 0x0063: - case 0x006e: - case 0x006f: - case 0x0072: - case 0x0073: - case 0x0074: - case 0x0075: - case 0x0076: - case 0x0077: - case 0x0078: - case 0x0079: - case 0x007a: - case 0x007b: - case 0x007c: - case 0x007d: - case 0x007e: - case 0x007f: - case 0x0080: - case 0x0081: - case 0x0082: - case 0x0083: - case 0x0088: - case 0x0089: - case 0x008e: - case 0x008f: - case 0x0090: - case 0x009d: - case 0x00a0: - case 0x00a3: - case 0x00a6: - case 0x00a9: - case 0x00ac: - case 0x00af: - case 0x00ba: - case 0x00bb: - case 0x00bd: - case 0x00bc: - case 0x00c3: - case 0x00c4: - case 0x00c5: - case 0x00c6: - case 0x00c7: - case 0x00c8: - case 0x00c9: - case 0x00ca: - case 0x00d4: - case 0x00e2: - case 0x00e5: - case 0x00ea: - case 0x00eb: - case 0x00ef: - case 0x00f0: - case 0x00f1: - case 0x00f6: - case 0x00f7: - case 0x00f8: - case 0x00fc: - case 0x00fd: - case 0x0103: - case 0x0105: - case 0x0107: - case 0x0108: - case 0x0109: - case 0x010a: - case 0x010c: - case 0x010f: - case 0x0110: - case 0x0113: - case 0x011a: - case 0x011d: - case 0x011e: - case 0x011f: - case 0x0120: - case 0x0121: - case 0x0122: - case 0x0123: - case 0x0125: - case 0x0126: - case 0x0127: - case 0x0128: - case 0x0129: - case 0x012a: - case 0x012b: - case 0x012c: - case 0x0133: - case 0x0134: - case 0x0135: - case 0x0137: - case 0x0138: - case 0x013a: - case 0x013c: - case 0x013d: - case 0x013f: - case 0x0140: - case 0x0147: - case 0x0149: - case 0x014a: - case 0x014b: - case 0x0152: - case 0x0165: - case 0x0166: - case 0x0168: - case 0x0169: - case 0x016a: - case 0x016f: - case 0x0170: - case 0x0171: - case 0x0172: - case 0x0173: - case 0x0174: - case 0x0176: - case 0x0178: - case 0x017a: - case 0x017b: - case 0x0181: - case 0x0182: - case 0x0183: - case 0x0186: - case 0x0187: - case 0x0188: - case 0x018a: - case 0x018e: - case 0x018f: - case 0x0192: - case 0x0193: - case 0x019e: - case 0x01a5: - case 0x01a6: - case 0x01a7: - case 0x01aa: - case 0x01ab: - case 0x01b4: - case 0x01ba: - case 0x01bc: - case 0x01bd: - case 0x01be: - case 0x01c0: - case 0x01c9: - case 0x01cc: - case 0x01d7: - case 0x01d8: - case 0x01dd: - case 0x01df: - case 0x01de: - return true; - } +u8 g_TopLengths[] = { + /* 0x00 */ 3, + /* 0x01 */ 3, + /* 0x02 */ 3, + /* 0x03 */ 3, + /* 0x04 */ 3, + /* 0x05 */ 3, + /* 0x06 */ 3, + /* 0x07 */ 3, + /* 0x08 */ 7, + /* 0x09 */ 7, + /* 0x0a */ 7, + /* 0x0b */ 7, + /* 0x0c */ 7, + /* 0x0d */ 3, + /* 0x0e */ 3, + /* 0x0f */ 3, + /* 0x10 */ 3, + /* 0x11 */ 4, + /* 0x12 */ 4, + /* 0x13 */ 3, + /* 0x14 */ 4, + /* 0x15 */ 4, + /* 0x16 */ 3, + /* 0x17 */ 4, + /* 0x18 */ 4, + /* 0x19 */ 3, + /* 0x1a */ 3, + /* 0x1b */ 3, + /* 0x1c */ 4, + /* 0x1d */ 4, + /* 0x1e */ 3, + /* 0x1f */ 7, + /* 0x20 */ 3, + /* 0x21 */ 4, + /* 0x22 */ 3, + /* 0x23 */ 3, + /* 0x24 */ 5, + /* 0x25 */ 3, + /* 0x26 */ 3, + /* 0x27 */ 3, + /* 0x28 */ 4, + /* 0x29 */ 6, + /* 0x2a */ 4, + /* 0x2b */ 4, + /* 0x2c */ 5, + /* 0x2d */ 5, + /* 0x2e */ 8, + /* 0x2f */ 8, + /* 0x30 */ 6, + /* 0x31 */ 6, + /* 0x32 */ 7, + /* 0x33 */ 7, + /* 0x34 */ 5, + /* 0x35 */ 4, + /* 0x36 */ 5, + /* 0x37 */ 5, + /* 0x38 */ 5, + /* 0x39 */ 4, + /* 0x3a */ 5, + /* 0x3b */ 5, + /* 0x3c */ 5, + /* 0x3d */ 4, + /* 0x3e */ 4, + /* 0x3f */ 4, + /* 0x40 */ 4, + /* 0x41 */ 4, + /* 0x42 */ 4, + /* 0x43 */ 4, + /* 0x44 */ 4, + /* 0x45 */ 4, + /* 0x46 */ 4, + /* 0x47 */ 4, + /* 0x48 */ 5, + /* 0x49 */ 5, + /* 0x4a */ 9, + /* 0x4b */ 9, + /* 0x4c */ 8, + /* 0x4d */ 7, + /* 0x4e */ 8, + /* 0x4f */ 8, + /* 0x50 */ 6, + /* 0x51 */ 6, + /* 0x52 */ 5, + /* 0x53 */ 5, + /* 0x54 */ 13, + /* 0x55 */ 12, + /* 0x56 */ 10, + /* 0x57 */ 10, + /* 0x58 */ 7, + /* 0x59 */ 4, + /* 0x5a */ 6, + /* 0x5b */ 6, + /* 0x5c */ 3, + /* 0x5d */ 4, + /* 0x5e */ 3, + /* 0x5f */ 6, + /* 0x60 */ 6, + /* 0x61 */ 3, + /* 0x62 */ 8, + /* 0x63 */ 8, + /* 0x64 */ 4, + /* 0x65 */ 4, + /* 0x66 */ 5, + /* 0x67 */ 3, + /* 0x68 */ 3, + /* 0x69 */ 3, + /* 0x6a */ 4, + /* 0x6b */ 4, + /* 0x6c */ 3, + /* 0x6d */ 3, + /* 0x6e */ 4, + /* 0x6f */ 5, + /* 0x70 */ 3, + /* 0x71 */ 4, + /* 0x72 */ 4, + /* 0x73 */ 5, + /* 0x74 */ 4, + /* 0x75 */ 5, + /* 0x76 */ 4, + /* 0x77 */ 5, + /* 0x78 */ 4, + /* 0x79 */ 4, + /* 0x7a */ 4, + /* 0x7b */ 7, + /* 0x7c */ 5, + /* 0x7d */ 4, + /* 0x7e */ 5, + /* 0x7f */ 4, + /* 0x80 */ 4, + /* 0x81 */ 3, + /* 0x82 */ 3, + /* 0x83 */ 4, + /* 0x84 */ 5, + /* 0x85 */ 4, + /* 0x86 */ 3, + /* 0x87 */ 6, + /* 0x88 */ 3, + /* 0x89 */ 4, + /* 0x8a */ 7, + /* 0x8b */ 8, + /* 0x8c */ 6, + /* 0x8d */ 4, + /* 0x8e */ 5, + /* 0x8f */ 3, + /* 0x90 */ 7, + /* 0x91 */ 5, + /* 0x92 */ 3, + /* 0x93 */ 8, + /* 0x94 */ 3, + /* 0x95 */ 2, + /* 0x96 */ 2, + /* 0x97 */ 5, + /* 0x98 */ 5, + /* 0x99 */ 4, + /* 0x9a */ 2, + /* 0x9b */ 2, + /* 0x9c */ 2, + /* 0x9d */ 12, + /* 0x9e */ 8, + /* 0x9f */ 5, + /* 0xa0 */ 4, + /* 0xa1 */ 3, + /* 0xa2 */ 4, + /* 0xa3 */ 4, + /* 0xa4 */ 2, + /* 0xa5 */ 3, + /* 0xa6 */ 2, + /* 0xa7 */ 2, + /* 0xa8 */ 2, + /* 0xa9 */ 3, + /* 0xaa */ 3, + /* 0xab */ 3, + /* 0xac */ 4, + /* 0xad */ 5, + /* 0xae */ 3, + /* 0xaf */ 3, + /* 0xb0 */ 4, + /* 0xb1 */ 3, + /* 0xb2 */ 3, + /* 0xb3 */ 3, + /* 0xb4 */ 3, + /* 0xb5 */ 3, + /* 0xb6 */ 4, + /* 0xb7 */ 4, + /* 0xb8 */ 3, + /* 0xb9 */ 7, + /* 0xba */ 7, + /* 0xbb */ 8, + /* 0xbc */ 8, + /* 0xbd */ 6, + /* 0xbe */ 6, + /* 0xbf */ 6, + /* 0xc0 */ 6, + /* 0xc1 */ 7, + /* 0xc2 */ 7, + /* 0xc3 */ 7, + /* 0xc4 */ 7, + /* 0xc5 */ 7, + /* 0xc6 */ 7, + /* 0xc7 */ 3, + /* 0xc8 */ 4, + /* 0xc9 */ 4, + /* 0xca */ 2, + /* 0xcb */ 2, + /* 0xcc */ 2, + /* 0xcd */ 2, + /* 0xce */ 5, + /* 0xcf */ 6, + /* 0xd0 */ 9, + /* 0xd1 */ 5, + /* 0xd2 */ 6, + /* 0xd3 */ 3, + /* 0xd4 */ 5, + /* 0xd5 */ 3, + /* 0xd6 */ 4, + /* 0xd7 */ 5, + /* 0xd8 */ 8, + /* 0xd9 */ 3, + /* 0xda */ 3, + /* 0xdb */ 3, + /* 0xdc */ 3, + /* 0xdd */ 7, + /* 0xde */ 7, + /* 0xdf */ 7, + /* 0xe0 */ 7, + /* 0xe1 */ 3, + /* 0xe2 */ 2, + /* 0xe3 */ 10, + /* 0xe4 */ 3, + /* 0xe5 */ 4, + /* 0xe6 */ 4, + /* 0xe7 */ 8, + /* 0xe8 */ 2, + /* 0xe9 */ 2, + /* 0xea */ 3, + /* 0xeb */ 5, + /* 0xec */ 3, + /* 0xed */ 11, + /* 0xee */ 5, + /* 0xef */ 4, + /* 0xf0 */ 5, + /* 0xf1 */ 4, + /* 0xf2 */ 2, + /* 0xf3 */ 3, + /* 0xf4 */ 6, + /* 0xf5 */ 3, + /* 0xf6 */ 5, + /* 0xf7 */ 4, + /* 0xf8 */ 4, + /* 0xf9 */ 4, + /* 0xfa */ 8, + /* 0xfb */ 3, + /* 0xfc */ 3, +}; - return false; +u8 g_SubLengths[] = { + /* 0x00 */ 3, + /* 0x01 */ 4, + /* 0x02 */ 4, + /* 0x03 */ 4, + /* 0x04 */ 3, + /* 0x05 */ 4, + /* 0x06 */ 4, + /* 0x07 */ 3, + /* 0x08 */ 2, + /* 0x09 */ 2, + /* 0x0a */ 4, + /* 0x0b */ 3, + /* 0x0c */ 3, + /* 0x0d */ 5, + /* 0x0e */ 4, + /* 0x0f */ 3, + /* 0x10 */ 3, + /* 0x11 */ 3, + /* 0x12 */ 2, + /* 0x13 */ 2, + /* 0x14 */ 4, + /* 0x15 */ 2, + /* 0x16 */ 2, + /* 0x17 */ 7, + /* 0x18 */ 3, + /* 0x19 */ 6, + /* 0x1a */ 6, + /* 0x1b */ 2, + /* 0x1c */ 2, + /* 0x1d */ 4, + /* 0x1e */ 4, + /* 0x1f */ 3, + /* 0x20 */ 4, + /* 0x21 */ 3, + /* 0x22 */ 5, + /* 0x23 */ 3, + /* 0x24 */ 3, + /* 0x25 */ 11, + /* 0x26 */ 4, + /* 0x27 */ 4, + /* 0x28 */ 4, + /* 0x29 */ 3, + /* 0x2a */ 9, + /* 0x2b */ 4, + /* 0x2c */ 2, + /* 0x2d */ 3, + /* 0x2e */ 3, + /* 0x2f */ 2, + /* 0x30 */ 10, + /* 0x31 */ 5, + /* 0x32 */ 9, + /* 0x33 */ 3, + /* 0x34 */ 2, + /* 0x35 */ 3, + /* 0x36 */ 2, + /* 0x37 */ 2, + /* 0x38 */ 3, + /* 0x39 */ 4, + /* 0x3a */ 4, + /* 0x3b */ 3, + /* 0x3c */ 3, + /* 0x3d */ 4, + /* 0x3e */ 3, + /* 0x3f */ 3, + /* 0x40 */ 4, + /* 0x41 */ 18, + /* 0x42 */ 3, + /* 0x43 */ 3, + /* 0x44 */ 2, + /* 0x45 */ 5, + /* 0x46 */ 4, + /* 0x47 */ 3, + /* 0x48 */ 5, + /* 0x49 */ 4, + /* 0x4a */ 3, + /* 0x4b */ 4, + /* 0x4c */ 5, + /* 0x4d */ 5, + /* 0x4e */ 5, + /* 0x4f */ 6, + /* 0x50 */ 3, + /* 0x51 */ 6, + /* 0x52 */ 11, + /* 0x53 */ 3, + /* 0x54 */ 3, + /* 0x55 */ 2, +}; + +bool ailistIsGoto(u8 major, u8 minor) +{ + if (major == 0xff) { + return minor <= 0x06; + } else { + return major <= 0x93; + } } -extern u16 g_CommandLengths[]; +bool ailistGetLen(u8 major, u8 minor) +{ + if (major == 0xff) { + return g_SubLengths[minor]; + } else { + return g_TopLengths[major]; + } +} void ailistAnalyse(u8 *ailist, s32 *numcmdsptr, s32 *numlabelsptr, s32 *numgotosptr, s32 *oldsizeptr) { @@ -295,16 +430,19 @@ void ailistAnalyse(u8 *ailist, s32 *numcmdsptr, s32 *numlabelsptr, s32 *numgotos s32 type; do { - type = ptr[0] << 8 | ptr[1]; + u8 major = ptr[0]; + u8 minor = ptr[1]; - if (type == 0x0002) { + type = major << 8 | minor; + + if (type == CMD_LABEL) { numlabels++; - } else if (ailistIsGoto(type)) { + } else if (ailistIsGoto(major, minor)) { numgotos++; } numcmds++; - ptr += g_CommandLengths[type]; + ptr += ailistGetLen(major, minor); } while (type != CMD_END); *numcmdsptr = numcmds; @@ -333,7 +471,10 @@ void ailistConvert(u8 *src, u8 *dst, struct tmpcmd *cmds, s32 numcmds) // Start by building the tmpcmd list, but keeping the target pointers NULL do { - type = ptr[0] << 8 | ptr[1]; + u8 major = ptr[0]; + u8 minor = ptr[1]; + + type = major << 8 | minor; cmds[i].type = type; cmds[i].oldoffset = ptr - src; @@ -341,12 +482,12 @@ void ailistConvert(u8 *src, u8 *dst, struct tmpcmd *cmds, s32 numcmds) cmds[i].labelnum = 0xff; cmds[i].gotolabelnum = 0xff; cmds[i].target = NULL; - cmds[i].len = g_CommandLengths[type]; + cmds[i].len = ailistGetLen(major, minor); - if (type == 0x0002) { + if (type == CMD_LABEL) { cmds[i].labelnum = ptr[2]; - } else if (ailistIsGoto(type)) { - if (type == 0x01c0) { + } else if (ailistIsGoto(major, minor)) { + if (type == 0xff05) { cmds[i].gotolabelnum = ptr[2]; } else { cmds[i].gotolabelnum = ptr[cmds[i].len - 1]; @@ -364,7 +505,7 @@ void ailistConvert(u8 *src, u8 *dst, struct tmpcmd *cmds, s32 numcmds) // Iterate again and populate the target pointers for (i = 0; i < numcmds; i++) { if (cmds[i].gotolabelnum != 0xff) { - j = cmds[i].type == 0x0001 ? 0 : i + 1; + j = cmds[i].type == CMD_GOTOFIRST ? 0 : i + 1; while (j < numcmds) { if (cmds[j].labelnum == cmds[i].gotolabelnum) { @@ -388,10 +529,10 @@ void ailistConvert(u8 *src, u8 *dst, struct tmpcmd *cmds, s32 numcmds) for (i = 0; i < numcmds; i++) { if (cmds[i].labelnum != 0xff) { // Label - don't write it - } else if (cmds[i].type == 0x01c0) { + } else if (cmds[i].type == 0xff05) { // Special goto with label as first param instead of last - ptr[0] = 0x01; - ptr[1] = 0xc0; + ptr[0] = 0xff; + ptr[1] = 0x05; ptr[2] = cmds[i].target->newoffset >> 8; ptr[3] = cmds[i].target->newoffset & 0xff; ptr[4] = src[cmds[i].oldoffset + 3]; diff --git a/src/setups/setupame.c b/src/setups/setupame.c index 741bc19fd..115df7459 100644 --- a/src/setups/setupame.c +++ b/src/setups/setupame.c @@ -3303,7 +3303,6 @@ u8 func1000_rebuild_groups[] = { }; u8 func1401_setup_counterop[] = { - noop016c yield set_chr_team(CHR_ANTI, TEAM_ENEMY) set_ailist(CHR_SELF, GAILIST_REBUILD_GROUPS) diff --git a/src/setups/setupoat.c b/src/setups/setupoat.c index 163832a33..d0a255070 100644 --- a/src/setups/setupoat.c +++ b/src/setups/setupoat.c @@ -130,7 +130,6 @@ u8 func0402_init_maian[] = { }; u8 func1001_01a4[] = { - noop016c rebuild_teams rebuild_squadrons set_ailist(CHR_SELF, GAILIST_IDLE) diff --git a/src/setups/setupold.c b/src/setups/setupold.c index c02bad2ac..d64889abf 100644 --- a/src/setups/setupold.c +++ b/src/setups/setupold.c @@ -39,131 +39,6 @@ struct path paths[] = { { NULL, 0, 0 }, }; -/** - * This function is an old and unused method of programming the title screen. - */ -u8 func0c00_017c[] = { - set_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) - set_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) - play_cutscene_track(MUSIC_G5_INTRO) - camera_movement(ANIM_CUT_OLD_TITLE_CAM_01) - title_init_mode(TITLEAIMODE_RARELOGO) - - beginloop(0x12) - try_exit_title(/*goto*/ 0x59) - endloop(0x12) - - label(0x59) - title_init_mode(TITLEAIMODE_NINTENDOLOGO) - - beginloop(0x13) - try_exit_title(/*goto*/ 0x59) - endloop(0x13) - - label(0x59) - camera_movement(ANIM_CUT_OLD_TITLE_CAM_01) - enable_object(0x00) - set_object_flag2(0x00, OBJFLAG2_04000000) - set_object_flag3(0x00, OBJFLAG3_00000010) - object_do_animation(ANIM_CUT_OLD_TITLE_CRATE1_01, 0x00, 0x04, 0xffff) - - beginloop(0x08) - if_camera_animating(/*goto*/ 0x31) - goto_next(0x59) - - label(0x31) - if_controller_button_pressed(/*goto*/ 0x59) - label(0x31) - endloop(0x08) - - label(0x59) - disable_object(0x00) - camera_movement(ANIM_CUT_OLD_TITLE_CAM_02) - enable_object(0x01) - set_object_flag2(0x01, OBJFLAG2_04000000) - set_object_flag3(0x01, OBJFLAG3_00000010) - object_do_animation(ANIM_CUT_OLD_TITLE_CRATE2_01, 0x01, 0x04, 0xffff) - - beginloop(0x0b) - if_camera_animating(/*goto*/ 0x31) - goto_next(0x59) - - label(0x31) - if_controller_button_pressed(/*goto*/ 0x59) - label(0x31) - endloop(0x0b) - - label(0x59) - disable_object(0x01) - camera_movement(ANIM_CUT_OLD_TITLE_CAM_03) - - enable_object(0x00) - set_object_flag2(0x00, OBJFLAG2_04000000) - set_object_flag3(0x00, OBJFLAG3_00000010) - object_do_animation(ANIM_CUT_OLD_TITLE_CRATE1_02, 0x00, 0x04, 0xffff) - - enable_object(0x01) - set_object_flag2(0x01, OBJFLAG2_04000000) - set_object_flag3(0x01, OBJFLAG3_00000010) - object_do_animation(ANIM_CUT_OLD_TITLE_CRATE2_02, 0x01, 0x04, 0xffff) - - beginloop(0x0a) - if_camera_animating(/*goto*/ 0x31) - goto_next(0x59) - - label(0x31) - if_controller_button_pressed(/*goto*/ 0x59) - label(0x31) - endloop(0x0a) - - label(0x59) - disable_object(0x01) - disable_object(0x00) - camera_movement(ANIM_CUT_OLD_TITLE_CAM_04) - - enable_object(0x01) - unset_object_flag2(0x01, OBJFLAG2_04000000) - set_object_flag3(0x01, OBJFLAG3_00000010) - object_do_animation(ANIM_CUT_OLD_TITLE_CRATE2_03, 0x01, 0x04, 0xffff) - - enable_object(0x00) - set_object_flag2(0x00, OBJFLAG2_04000000) - set_object_flag3(0x00, OBJFLAG3_00000010) - object_do_animation(ANIM_CUT_OLD_TITLE_CRATE1_03, 0x00, 0x04, 0xffff) - - enable_object(0x02) - set_object_flag2(0x02, OBJFLAG2_04000000) - set_object_flag3(0x02, OBJFLAG3_00000010) - object_do_animation(ANIM_CUT_OLD_TITLE_CRATE3, 0x02, 0x04, 0xffff) - - beginloop(0x0e) - if_camera_animating(/*goto*/ 0x31) - goto_next(0x59) - - label(0x31) - if_controller_button_pressed(/*goto*/ 0x59) - label(0x31) - endloop(0x0e) - - label(0x59) - unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN) - unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) - title_init_mode(TITLEAIMODE_PDLOGO) - - beginloop(0x15) - try_exit_title(/*goto*/ 0x59) - endloop(0x15) - - label(0x59) - stop_cutscene_track - stop_ambient_track - enter_firstperson - set_ailist(CHR_SELF, GAILIST_IDLE) - endlist -}; - struct ailist ailists[] = { - { func0c00_017c, 0x0401 }, - { func0c00_017c, 0x0c00 }, { NULL, 0 }, }; diff --git a/src/setups/setupwax.c b/src/setups/setupwax.c index 3a56255ed..735abc321 100644 --- a/src/setups/setupwax.c +++ b/src/setups/setupwax.c @@ -1236,7 +1236,6 @@ u8 func1001_objectives_failed_msg[] = { }; u8 func1000_setup_counterop[] = { - noop016c yield set_chr_team(CHR_ANTI, TEAM_ENEMY) yield