mirror of
https://github.com/pmret/papermario.git
synced 2024-11-18 08:52:40 +01:00
SetNpcB5_3
This commit is contained in:
parent
6bfd58db59
commit
69fd94e161
@ -233,8 +233,18 @@ typedef struct ScriptInstance {
|
||||
/* 0x13C */ s32* array;
|
||||
/* 0x140 */ s32* flagArray;
|
||||
/* 0x144 */ ScriptID id;
|
||||
/* 0x148 */ struct Enemy* ownerActorID; /* controller*, battle ID, trigger* */
|
||||
/* 0x14C */ u32 ownerID; /* can be an npcID, a triggerID, a trigger ptr */
|
||||
/* 0x148 */ union {
|
||||
s32 enemyID;
|
||||
s32 actorID;
|
||||
struct Enemy* enemy; ///< For overworld scripts owned by an Npc
|
||||
struct Actor* actor; ///< For battle scripts
|
||||
} owner1; ///< Initially -1
|
||||
/* 0x14C */ union {
|
||||
NpcId npcID;
|
||||
s32 triggerID;
|
||||
struct Npc* npc; ///< For overworld scripts owned by an Npc
|
||||
struct Trigger* trigger;
|
||||
} owner2; ///< Initially -1
|
||||
/* 0x150 */ f32 timeScale;
|
||||
/* 0x154 */ f32 frameCounter;
|
||||
/* 0x158 */ s32 unk_158;
|
||||
|
@ -34,7 +34,7 @@ ApiStatus ActorSpeak(ScriptInstance* script, s32 isInitialCall) {
|
||||
stringID2 = stringID;
|
||||
|
||||
if (actorID == ActorId_SELF) {
|
||||
actorID = script->ownerActorID;
|
||||
actorID = script->owner1.actorID;
|
||||
}
|
||||
|
||||
actor = get_actor(actorID);
|
||||
@ -145,7 +145,7 @@ ApiStatus PlaySoundAtActor(ScriptInstance* script, s32 isInitialCall) {
|
||||
Actor* actor;
|
||||
|
||||
if (actorID == ActorId_SELF) {
|
||||
actorID = script->ownerActorID;
|
||||
actorID = script->owner1.actorID;
|
||||
}
|
||||
|
||||
actor = get_actor(actorID);
|
||||
@ -202,7 +202,7 @@ INCLUDE_ASM(s32, "code_181810", func_80253FB0);
|
||||
|
||||
ApiStatus MultiplyByActorScale(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Actor* actor = get_actor(script->ownerActorID);
|
||||
Actor* actor = get_actor(script->owner1.actorID);
|
||||
|
||||
set_float_variable(script, *args, get_float_variable(script, *args) * actor->scalingFactor);
|
||||
return ApiStatus_DONE2;
|
||||
|
@ -125,7 +125,7 @@ ApiStatus IncrementPlayerFP(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus func_80261D98(ScriptInstance* script, s32 isInitialCall) {
|
||||
inflict_status_set_duration(get_actor(script->ownerActorID), 4, 0, 1);
|
||||
inflict_status_set_duration(get_actor(script->owner1.actorID), 4, 0, 1);
|
||||
func_8026777C();
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
@ -227,12 +227,12 @@ INCLUDE_ASM(s32, "code_197F40", func_8026DA94);
|
||||
INCLUDE_ASM(s32, "code_197F40", SummonEnemy);
|
||||
|
||||
ApiStatus GetOwnerID(ScriptInstance* script, s32 isInitialCall) {
|
||||
set_variable(script, *script->ptrReadPos, script->ownerActorID);
|
||||
set_variable(script, *script->ptrReadPos, script->owner1.actorID);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus SetOwnerID(ScriptInstance* script, s32 isInitialCall) {
|
||||
script->ownerActorID = get_variable(script, *script->ptrReadPos);
|
||||
script->owner1.actorID = get_variable(script, *script->ptrReadPos);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ ApiStatus ActorExists(ScriptInstance* script, s32 isInitialCall) {
|
||||
ActorId actorID = get_variable(script, *args++);
|
||||
|
||||
if (actorID == ActorId_SELF) {
|
||||
actorID = script->ownerActorID;
|
||||
actorID = script->owner1.actorID;
|
||||
}
|
||||
|
||||
isExist = get_actor(actorID) != NULL;
|
||||
@ -330,7 +330,7 @@ INCLUDE_ASM(s32, "code_197F40", func_8026E260);
|
||||
|
||||
ApiStatus PlayerCreateTargetList(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Actor* actor = get_actor(script->ownerActorID);
|
||||
Actor* actor = get_actor(script->owner1.actorID);
|
||||
|
||||
gBattleStatus.currentTargetListFlags = *args;
|
||||
player_create_target_list(actor);
|
||||
@ -340,7 +340,7 @@ ApiStatus PlayerCreateTargetList(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus EnemyCreateTargetList(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Actor* actor = get_actor(script->ownerActorID);
|
||||
Actor* actor = get_actor(script->owner1.actorID);
|
||||
|
||||
gBattleStatus.currentTargetListFlags = *args;
|
||||
enemy_create_target_list(actor);
|
||||
|
@ -24,7 +24,7 @@ ApiStatus GetActorLevel(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* outVar;
|
||||
|
||||
if (actorID == -0x7F) {
|
||||
actorID = script->ownerActorID;
|
||||
actorID = script->owner1.enemyID;
|
||||
}
|
||||
|
||||
outVar = *args++;
|
||||
|
@ -49,22 +49,22 @@ ApiStatus GetBattleOutcome(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus func_800445A8(ScriptInstance* script, s32 isInitialCall) {
|
||||
set_variable(script, *script->ptrReadPos, script->ownerActorID->unk_C4);
|
||||
set_variable(script, *script->ptrReadPos, script->owner1.enemy->unk_C4);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus func_800445D4(ScriptInstance* script, s32 isInitialCall) {
|
||||
set_variable(script, *script->ptrReadPos, script->ownerActorID->unk_C8);
|
||||
set_variable(script, *script->ptrReadPos, script->owner1.enemy->unk_C8);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus GetOwnerEncounterTrigger(ScriptInstance* script, s32 isInitialCall) {
|
||||
set_variable(script, *script->ptrReadPos, script->ownerActorID->encountered);
|
||||
set_variable(script, *script->ptrReadPos, script->owner1.enemy->encountered);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus DoNpcDefeat(ScriptInstance* script, s32 isInitialCall) {
|
||||
Enemy* owner = script->ownerActorID;
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
Npc* temp_s1 = get_npc_unsafe(owner->npcID);
|
||||
ScriptInstance* newScript;
|
||||
|
||||
@ -73,8 +73,8 @@ ApiStatus DoNpcDefeat(ScriptInstance* script, s32 isInitialCall) {
|
||||
newScript = start_script(&SCRIPT_NpcDefeat, 10, 0);
|
||||
owner->defeatScript = newScript;
|
||||
owner->defeatScriptID = newScript->id;
|
||||
newScript->ownerActorID = owner;
|
||||
newScript->ownerID = owner->npcID;
|
||||
newScript->owner1.enemy = owner;
|
||||
newScript->owner2.npcID = owner->npcID;
|
||||
newScript->groupFlags = owner->scriptGroup;
|
||||
|
||||
return ApiStatus_FINISH;
|
||||
@ -108,7 +108,7 @@ INCLUDE_ASM(s32, "code_1f580_len_1940", BindNpcAI, ScriptInstance* script, s32 i
|
||||
|
||||
ApiStatus BindNpcIdle(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* owner = script->ownerActorID;
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
NpcId npcID = get_variable(script, *args++);
|
||||
Bytecode* aiBytecode = (Bytecode*)get_variable(script, *args);
|
||||
|
||||
@ -124,7 +124,7 @@ ApiStatus BindNpcIdle(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus RestartNpcAI(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
ScriptInstance* newScript;
|
||||
s32 groupFlags;
|
||||
@ -149,8 +149,8 @@ ApiStatus RestartNpcAI(ScriptInstance* script, s32 isInitialCall) {
|
||||
newScript = start_script(npc->aiBytecode, 10, 0);
|
||||
npc->aiScript = newScript;
|
||||
npc->aiScriptID = newScript->id;
|
||||
newScript->ownerActorID = npc;
|
||||
newScript->ownerID = script->ownerID;
|
||||
newScript->owner1.enemy = npc;
|
||||
newScript->owner2.npc = script->owner2.npc;
|
||||
newScript->groupFlags = groupFlags;
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
@ -158,7 +158,7 @@ ApiStatus RestartNpcAI(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus EnableNpcAI(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
s32 var2 = get_variable(script, *args);
|
||||
|
||||
@ -183,7 +183,7 @@ INCLUDE_ASM(s32, "code_1f580_len_1940", SetNpcAux, ScriptInstance* script, s32 i
|
||||
|
||||
ApiStatus BindNpcAux(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
Bytecode* auxBytecode = (Bytecode*)get_variable(script, *args);
|
||||
|
||||
@ -199,16 +199,16 @@ ApiStatus BindNpcAux(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus RestartNpcAux(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
NpcId npcID = get_variable(script, *args++);
|
||||
ScriptInstance* newScript;
|
||||
s32 groupFlags;
|
||||
|
||||
if (npcId == NpcId_SELF) {
|
||||
npcId = npc->npcID;
|
||||
if (npcID == NpcId_SELF) {
|
||||
npcID = npc->npcID;
|
||||
}
|
||||
|
||||
npc = get_enemy(npcId);
|
||||
npc = get_enemy(npcID);
|
||||
|
||||
if (npc->flags & 1) {
|
||||
groupFlags = 10;
|
||||
@ -223,8 +223,8 @@ ApiStatus RestartNpcAux(ScriptInstance* script, s32 isInitialCall) {
|
||||
newScript = start_script(npc->auxBytecode, 10, 0);
|
||||
npc->auxScript = newScript;
|
||||
npc->auxScriptID = newScript->id;
|
||||
newScript->ownerActorID = npc;
|
||||
newScript->ownerID = npcId;
|
||||
newScript->owner1.enemy = npc;
|
||||
newScript->owner2.npcID = npcID;
|
||||
newScript->groupFlags = groupFlags;
|
||||
|
||||
return ApiStatus_DONE2;
|
||||
@ -232,7 +232,7 @@ ApiStatus RestartNpcAux(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus EnableNpcAux(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
s32 var2 = get_variable(script, *args);
|
||||
|
||||
@ -255,7 +255,7 @@ ApiStatus EnableNpcAux(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus BindNpcInteract(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
Bytecode* interactBytecode = (Bytecode*)get_variable(script, *args);
|
||||
|
||||
@ -275,7 +275,7 @@ ApiStatus BindNpcInteract(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus BindNpcHit(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
Bytecode* hitBytecode = (Bytecode*)get_variable(script, *args);
|
||||
|
||||
@ -295,7 +295,7 @@ ApiStatus BindNpcHit(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus BindNpcDefeat(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
s32 npcId = get_variable(script, *args++);
|
||||
Bytecode* defeatBytecode = (Bytecode*)get_variable(script, *args);
|
||||
|
||||
@ -311,7 +311,7 @@ ApiStatus BindNpcDefeat(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus SetSelfVar(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* owner = script->ownerActorID;
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
s32 var1 = get_variable(script, *args++);
|
||||
s32 var2 = get_variable(script, *args);
|
||||
|
||||
@ -322,13 +322,13 @@ ApiStatus SetSelfVar(ScriptInstance* script, s32 isInitialCall) {
|
||||
ApiStatus GetSelfVar(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
|
||||
set_variable(script, *args, script->ownerActorID->varTable[get_variable(script, *args++)]);
|
||||
set_variable(script, *args, script->owner1.enemy->varTable[get_variable(script, *args++)]);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus SetNpcVar(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
s32 varIdx = get_variable(script, *args++);
|
||||
s32 val = get_variable(script, *args);
|
||||
@ -350,7 +350,7 @@ ApiStatus GetNpcVar(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 varIdx;
|
||||
s32 var3;
|
||||
|
||||
npc = script->ownerActorID;
|
||||
npc = script->owner1.enemy;
|
||||
npcID = get_variable(script, *args++);
|
||||
varIdx = get_variable(script, *args++);
|
||||
var3 = *args;
|
||||
@ -367,7 +367,7 @@ ApiStatus GetNpcVar(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus SetSelfRotation(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Npc* self = get_npc_unsafe(script->ownerID);
|
||||
Npc* self = get_npc_unsafe(script->owner2.npcID);
|
||||
s32 rotX = get_variable(script, *args++);
|
||||
s32 rotY = get_variable(script, *args++);
|
||||
s32 rotZ = get_variable(script, *args++);
|
||||
@ -380,13 +380,13 @@ ApiStatus SetSelfRotation(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus SetSelfEnemyFlags(ScriptInstance* script, s32 isInitialCall) {
|
||||
script->ownerActorID->flags = *script->ptrReadPos;
|
||||
script->owner1.enemy->flags = *script->ptrReadPos;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
ApiStatus SetSelfEnemyFlagBits(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* owner = script->ownerActorID;
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
s32 bits = *args++;
|
||||
|
||||
if (get_variable(script, *args)) {
|
||||
@ -399,8 +399,8 @@ ApiStatus SetSelfEnemyFlagBits(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus func_80045580(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* owner = script->ownerActorID;
|
||||
Npc* npc = get_npc_unsafe(script->ownerID);
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
Npc* npc = get_npc_unsafe(script->owner2.npcID);
|
||||
|
||||
owner->unk_07 = get_variable(script, *args);
|
||||
owner->unk_10.x = npc->pos.x;
|
||||
@ -411,7 +411,7 @@ ApiStatus func_80045580(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus GetSelfNpcID(ScriptInstance* script, s32 isInitialCall) {
|
||||
set_variable(script, *script->ptrReadPos, script->ownerActorID->npcID);
|
||||
set_variable(script, *script->ptrReadPos, script->owner1.enemy->npcID);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ ApiStatus ClearDefeatedEnemies(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus SetEnemyFlagBits(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* npc = script->ownerActorID;
|
||||
Enemy* npc = script->owner1.enemy;
|
||||
NpcId npcId = get_variable(script, *args++);
|
||||
s32 bits = *args++;
|
||||
s32 var2 = get_variable(script, *args);
|
||||
@ -456,7 +456,7 @@ ApiStatus func_8004572C(ScriptInstance* script, s32 isInitialCall) {
|
||||
|
||||
ApiStatus GetSelfAnimationFromTable(ScriptInstance* script, s32 isInitialCall) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
Enemy* owner = script->ownerActorID;
|
||||
Enemy* owner = script->owner1.enemy;
|
||||
|
||||
set_variable(script, *args, owner->animList[get_variable(script, *args++)]);
|
||||
return ApiStatus_DONE2;
|
||||
@ -468,7 +468,7 @@ ApiStatus func_80045798(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus func_800457C4(ScriptInstance* script, s32 isInitialCall) {
|
||||
Enemy* ownerActor = script->ownerActorID;
|
||||
Enemy* ownerActor = script->owner1.enemy;
|
||||
|
||||
ownerActor->unk_B5 = get_variable(script, *script->ptrReadPos);
|
||||
return ApiStatus_DONE2;
|
||||
@ -502,7 +502,7 @@ ApiStatus func_80045838(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus func_800458CC(ScriptInstance* script, s32 isInitialCall) {
|
||||
set_variable(script, *script->ptrReadPos, script->ownerActorID->npcSettings->unk_2A & 8);
|
||||
set_variable(script, *script->ptrReadPos, script->owner1.enemy->npcSettings->unk_2A & 8);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
@ -190,8 +190,8 @@ ScriptInstance* start_script(Bytecode* initialLine, s32 priority, s32 initialSta
|
||||
newScript->childScript = NULL;
|
||||
newScript->parentScript = NULL;
|
||||
newScript->id = gStaticScriptCounter++;
|
||||
newScript->ownerActorID = -1;
|
||||
newScript->ownerID = -1;
|
||||
newScript->owner1.actorID = -1;
|
||||
newScript->owner2.npcID = -1;
|
||||
newScript->loopDepth = -1;
|
||||
newScript->switchDepth = -1;
|
||||
newScript->groupFlags = ~0x10;
|
||||
@ -261,8 +261,8 @@ ScriptInstance* start_script_in_group(Bytecode* initialLine, u8 priority, s32 in
|
||||
newScript->childScript = NULL;
|
||||
newScript->parentScript = NULL;
|
||||
newScript->id = gStaticScriptCounter++;
|
||||
newScript->ownerActorID = -1;
|
||||
newScript->ownerID = -1;
|
||||
newScript->owner1.actorID = -1;
|
||||
newScript->owner2.npcID = -1;
|
||||
newScript->loopDepth = -1;
|
||||
newScript->switchDepth = -1;
|
||||
newScript->groupFlags = groupFlags;
|
||||
@ -334,8 +334,8 @@ ScriptInstance* func_802C39F8(ScriptInstance* parentScript, Bytecode* nextLine,
|
||||
child->childScript = NULL;
|
||||
child->priority = parentScript->priority;
|
||||
child->id = gStaticScriptCounter++;
|
||||
child->ownerActorID = parentScript->ownerActorID;
|
||||
child->ownerID = parentScript->ownerID;
|
||||
child->owner1.actorID = parentScript->owner1.actorID;
|
||||
child->owner2.npcID = parentScript->owner2.npcID;
|
||||
child->loopDepth = -1;
|
||||
child->switchDepth = -1;
|
||||
child->groupFlags = parentScript->groupFlags;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Npc* resolve_npc(ScriptInstance* script, NpcId npcIdOrPtr) {
|
||||
if (npcIdOrPtr == NpcId_SELF) {
|
||||
return get_npc_safe(script->ownerID);
|
||||
return get_npc_safe(script->owner2.npcID);
|
||||
} else if (npcIdOrPtr >= -270000000) {
|
||||
return get_npc_safe(npcIdOrPtr);
|
||||
} else {
|
||||
|
14
src/si.c
14
src/si.c
@ -864,8 +864,8 @@ ApiStatus si_handle_exec1(ScriptInstance* script) {
|
||||
newScript = start_script_in_group((ScriptInstance*)get_variable(script, *script->ptrReadPos), script->priority, 0,
|
||||
script->groupFlags);
|
||||
|
||||
newScript->ownerActorID = script->ownerActorID;
|
||||
newScript->ownerID = script->ownerID;
|
||||
newScript->owner1 = script->owner1;
|
||||
newScript->owner2 = script->owner2;
|
||||
|
||||
i = 0;
|
||||
while (i < ARRAY_COUNT(script->varTable)) {
|
||||
@ -892,8 +892,8 @@ ApiStatus si_handle_exec2(ScriptInstance* script) {
|
||||
|
||||
newScript = start_script_in_group(var, script->priority, 0, script->groupFlags);
|
||||
|
||||
newScript->ownerActorID = script->ownerActorID;
|
||||
newScript->ownerID = script->ownerID;
|
||||
newScript->owner1 = script->owner1;
|
||||
newScript->owner2 = script->owner2;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(script->varTable); i++) {
|
||||
newScript->varTable[i] = script->varTable[i];
|
||||
@ -939,7 +939,7 @@ s32 _bound_script_trigger_handler(Trigger* trigger) {
|
||||
script->varTable[0] = trigger->scriptVars[0];
|
||||
script->varTable[1] = trigger->scriptVars[1];
|
||||
script->varTable[2] = trigger->scriptVars[2];
|
||||
script->ownerID = trigger;
|
||||
script->owner2.trigger = trigger;
|
||||
}
|
||||
|
||||
if (!does_script_exist(trigger->runningScriptID)) {
|
||||
@ -988,7 +988,7 @@ ApiStatus DeleteTrigger(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus si_handle_unbind(ScriptInstance* script) {
|
||||
delete_trigger(script->ownerID);
|
||||
delete_trigger(script->owner2.trigger);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
@ -1059,7 +1059,7 @@ void si_standard_trigger_executor(Trigger* trigger) {
|
||||
newScript->varTable[0] = trigger->scriptVars[0];
|
||||
newScript->varTable[1] = trigger->scriptVars[1];
|
||||
newScript->varTable[2] = trigger->scriptVars[2];
|
||||
newScript->ownerID = trigger;
|
||||
newScript->owner2.trigger = trigger;
|
||||
}
|
||||
|
||||
if (!does_script_exist(trigger->runningScriptID)) {
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_isk/isk_02/978800", func_802400F0_978800);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -12,6 +12,6 @@ INCLUDE_ASM(s32, "world/area_isk/isk_04/97B670", func_802403D4);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_isk/isk_04/97B670", func_80240814);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_isk/isk_04/97B670", func_802408B4_97BEE4);
|
||||
|
@ -12,6 +12,6 @@ INCLUDE_ASM(s32, "world/area_isk/isk_08/984E30", func_80240394);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_isk/isk_08/984E30", func_802407D4);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_isk/isk_08/984E30", func_80240874);
|
||||
|
@ -12,6 +12,6 @@ INCLUDE_ASM(s32, "world/area_isk/isk_18/997F70", func_80240394_998304);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_isk/isk_18/997F70", func_802407D4_998744);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_isk/isk_18/997F70", func_80240874_9987E4);
|
||||
|
@ -12,6 +12,6 @@ INCLUDE_ASM(s32, "world/area_kpa/kpa_01/A470C0", func_802404F4);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kpa/kpa_01/A470C0", func_80240934);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kpa/kpa_01/A470C0", func_802409D4_A47934);
|
||||
|
@ -12,7 +12,7 @@ INCLUDE_ASM(s32, "world/area_kpa/kpa_03/A48720", func_802404F4_A48AB4);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kpa/kpa_03/A48720", func_80240934_A48EF4);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kpa/kpa_03/A48720", func_802409D4_A48F94);
|
||||
|
||||
|
@ -16,6 +16,6 @@ INCLUDE_ASM(s32, "world/area_kpa/kpa_113/A9CC70", func_80240544_A9D174);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kpa/kpa_113/A9CC70", func_80240984_A9D5B4);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kpa/kpa_113/A9CC70", func_80240A24_A9D654);
|
||||
|
@ -12,7 +12,7 @@ INCLUDE_ASM(s32, "world/area_kzn/kzn_03/C61020", func_802406A4_C613B4);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kzn/kzn_03/C61020", func_80240AE4_C617F4);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kzn/kzn_03/C61020", func_80240B84_C61894);
|
||||
|
||||
|
@ -42,7 +42,7 @@ INCLUDE_ASM(s32, "world/area_kzn/kzn_09/C77D00", func_80242D58);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kzn/kzn_09/C77D00", func_80243198_C79E78);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kzn/kzn_09/C77D00", func_80243238_C79F18);
|
||||
|
||||
|
@ -42,7 +42,7 @@ INCLUDE_ASM(s32, "world/area_kzn/kzn_17/C85DC0", func_80242048);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kzn/kzn_17/C85DC0", func_80242488_C87F38);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_kzn/kzn_17/C85DC0", func_80242528_C87FD8);
|
||||
|
||||
|
@ -1,7 +1 @@
|
||||
#include "common.h"
|
||||
#include "map.h"
|
||||
|
||||
ApiStatus func_80240040_9292B0(ScriptInstance* script, s32 isInitialCall) {
|
||||
script->ownerActorID->unk_B5 = 3;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_01/929AD0", func_80240040_929AD0);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_03/92F8F0", func_80240040_92F8F0);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_04/930510", func_80240040_930510);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_05/930D30", func_80240040_930D30);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_11/934080", func_80240040_934080);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_11/934080", func_80240140_934180);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_12/934D80", func_80240040_934D80);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_13/935820", func_80240040_935820);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_13/935820", func_80240140_935920);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_15/936D10", func_80240040_936D10);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_22/939970", func_80240040_939970);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_22/939970", func_80240140_939A70);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_26/93DD10", func_80240040_93DD10);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_26/93DD10", func_80240140_93DE10);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_32/944AA0", func_80240040_944AA0);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_32/944AA0", func_80240140_944BA0);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_44/94D5E0", func_80240040_94D5E0);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_44/94D5E0", func_80240140_94D6E0);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_46/94E9E0", func_80240040_94E9E0);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_46/94E9E0", func_80240140_94EAE0);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_51/9509B0", func_80240040_9509B0);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_51/9509B0", func_80240140_950AB0);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_53/951B20", func_80240040_951B20);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_55/952A90", func_80240040_952A90);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_60/956A30", func_80240040_956A30);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_62/957390", func_80240040_957390);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -1,3 +1 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_sbk/sbk_63/957DB0", func_80240040_957DB0);
|
||||
#include "world/common/SetNpcB5_3.inc.c"
|
||||
|
@ -12,6 +12,6 @@ INCLUDE_ASM(s32, "world/area_tik/tik_12/88A530", func_80241CF4);
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_tik/tik_12/88A530", func_80242134);
|
||||
|
||||
#include "world/common/AwaitPlayerNearNPC.inc.c"
|
||||
#include "world/common/AwaitPlayerNearNpc.inc.c"
|
||||
|
||||
INCLUDE_ASM(s32, "world/area_tik/tik_12/88A530", func_802421D4);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "common.h"
|
||||
|
||||
static ApiStatus AwaitPlayerNearNPC(ScriptInstance* script, s32 isInitialCall) {
|
||||
static ApiStatus AwaitPlayerNearNpc(ScriptInstance* script, s32 isInitialCall) {
|
||||
PlayerStatus* playerStatus = PLAYER_STATUS;
|
||||
Npc* npc = get_npc_safe(script->ownerID);
|
||||
Npc* npc = get_npc_safe(script->owner2.npcID);
|
||||
|
||||
if (dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z) < 50.0f) {
|
||||
return ApiStatus_DONE2;
|
7
src/world/common/SetNpcB5_3.inc.c
Normal file
7
src/world/common/SetNpcB5_3.inc.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "map.h"
|
||||
|
||||
static ApiStatus func_80240040_9292B0(ScriptInstance* script, s32 isInitialCall) {
|
||||
script->owner1.enemy->unk_B5 = 3;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
@ -6,25 +6,25 @@ void func_802BD100_324F10(Npc* npc) {
|
||||
}
|
||||
|
||||
ApiStatus func_802BD114_324F10(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 ownerID = script->ownerID;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EECC4(ownerID);
|
||||
func_800EECC4(owner);
|
||||
}
|
||||
return func_800EECE8(ownerID) != 0;
|
||||
return func_800EECE8(owner) != 0;
|
||||
}
|
||||
|
||||
|
||||
ApiStatus func_802BD14C_324F10(ScriptInstance* script, s32 isInitialCall) {
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
s32 ownerID = script->ownerID;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
enable_partner_walking(ownerID, TRUE);
|
||||
enable_partner_walking(owner, TRUE);
|
||||
}
|
||||
|
||||
func_800EBA3C(ownerID);
|
||||
func_800EBB40(ownerID);
|
||||
func_800EBA3C(owner);
|
||||
func_800EBB40(owner);
|
||||
playerData->unk_2F4[PartnerId_GOOMBARIA]++;
|
||||
|
||||
return ApiStatus_BLOCK;
|
||||
@ -35,10 +35,10 @@ ApiStatus func_802BD1AC_324F10(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus func_802BD1B4(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 ownerID = script->ownerID;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EE994(ownerID);
|
||||
func_800EE994(owner);
|
||||
}
|
||||
return func_800EE9B8(ownerID) != 0;
|
||||
return func_800EE9B8(owner) != 0;
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ void func_802BD100_324A10(Npc* npc) {
|
||||
}
|
||||
|
||||
ApiStatus func_802BD114(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 ownerID = script->ownerID;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EECC4(ownerID);
|
||||
func_800EECC4(owner);
|
||||
}
|
||||
return func_800EECE8(ownerID) != 0;
|
||||
return func_800EECE8(owner) != 0;
|
||||
}
|
||||
|
||||
|
||||
@ -24,10 +24,10 @@ ApiStatus func_802BD524(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus func_802BD52C(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 ownerID = script->ownerID;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EE994(ownerID);
|
||||
func_800EE994(owner);
|
||||
}
|
||||
return func_800EE9B8(ownerID) != 0;
|
||||
return func_800EE9B8(owner) != 0;
|
||||
}
|
||||
|
@ -7,24 +7,24 @@ void func_802BD100_325070(Npc* npc) {
|
||||
}
|
||||
|
||||
ApiStatus func_802BD110(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 ownerID = script->ownerID;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EECC4(ownerID);
|
||||
func_800EECC4(owner);
|
||||
}
|
||||
return func_800EECE8(ownerID) != 0;
|
||||
return func_800EECE8(owner) != 0;
|
||||
}
|
||||
|
||||
ApiStatus func_802BD148_325070(ScriptInstance* script, s32 isInitialCall) {
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
s32 ownerID = script->ownerID;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
enable_partner_flying(ownerID, TRUE);
|
||||
enable_partner_flying(owner, TRUE);
|
||||
}
|
||||
|
||||
update_player_move_history(ownerID);
|
||||
func_800ED5D0(ownerID);
|
||||
update_player_move_history(owner);
|
||||
func_800ED5D0(owner);
|
||||
playerData->unk_2F4[PartnerId_TWINK]++;
|
||||
|
||||
return ApiStatus_BLOCK;
|
||||
@ -35,10 +35,10 @@ ApiStatus func_802BD1A8(ScriptInstance* script, s32 isInitialCall) {
|
||||
}
|
||||
|
||||
ApiStatus func_802BD1B0(ScriptInstance* script, s32 isInitialCall) {
|
||||
s32 ownerID = script->ownerID;
|
||||
Npc* owner = script->owner2.npc;
|
||||
|
||||
if (isInitialCall) {
|
||||
func_800EE994(ownerID);
|
||||
func_800EE994(owner);
|
||||
}
|
||||
return func_800EE9B8(ownerID) != 0;
|
||||
return func_800EE9B8(owner) != 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user