1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 14:20:11 +00:00

En_Wonder_Item (#451)

* Darkmeiro decompilation

Bg_Gnd_Darkmeiro decompiled, matched, and documented.

* give this a shot

* fix conflict

* one more try

* could be useful

* whoops

* wonder item and incidental cleanup on wondertalk2

* merge update

* now with function names

* static variables

* the macros will rise again

* better (?) translation

* fix names
This commit is contained in:
petrie911 2020-11-21 13:18:14 -06:00 committed by GitHub
parent cf24a76fe4
commit 84a0acc9cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 475 additions and 1149 deletions

View file

@ -5,6 +5,7 @@
*/
#include "z_en_wonder_item.h"
#include "vt.h"
#define FLAGS 0x00000000
@ -14,7 +15,20 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx);
void EnWonderItem_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx);
/*
void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx);
void EnWonderItem_ProximityDrop(EnWonderItem* this, GlobalContext* globalCtx);
void EnWonderItem_InteractSwitch(EnWonderItem* this, GlobalContext* globalCtx);
void EnWonderItem_ProximitySwitch(EnWonderItem* this, GlobalContext* globalCtx);
void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx);
void EnWonderItem_BombSoldier(EnWonderItem* this, GlobalContext* globalCtx);
void EnWonderItem_RollDrop(EnWonderItem* this, GlobalContext* globalCtx);
static ColliderCylinderInit sCylinderInit = {
{ COLTYPE_UNK10, 0x00, 0x09, 0x00, 0x20, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x00, 0x01, 0x00 },
{ 20, 30, 0, { 0, 0, 0 } },
};
const ActorInit En_Wonder_Item_InitVars = {
ACTOR_EN_WONDER_ITEM,
ACTORTYPE_PROP,
@ -26,25 +40,314 @@ const ActorInit En_Wonder_Item_InitVars = {
(ActorFunc)EnWonderItem_Update,
NULL,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/EnWonderItem_Destroy.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/func_80B380A0.s")
static Vec3f sTagPointsFree[9];
static Vec3f sTagPointsOrdered[9];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/EnWonderItem_Init.s")
void EnWonderItem_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnWonderItem* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/func_80B38570.s")
if ((this->collider.dim.radius != 0) || (this->collider.dim.height != 0)) {
Collider_DestroyCylinder(globalCtx, &this->collider);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/func_80B38788.s")
void EnWonderItem_DropCollectible(EnWonderItem* this, GlobalContext* globalCtx, s32 autoCollect) {
static s16 dropTable[] = {
ITEM00_NUTS, ITEM00_HEART_PIECE, ITEM00_MAGIC_LARGE, ITEM00_MAGIC_SMALL,
ITEM00_HEART, ITEM00_ARROWS_SMALL, ITEM00_ARROWS_MEDIUM, ITEM00_ARROWS_LARGE,
ITEM00_RUPEE_GREEN, ITEM00_RUPEE_BLUE, ITEM00_RUPEE_RED, ITEM00_FLEXIBLE,
};
s32 i;
s32 randomDrop;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/func_80B387F0.s")
func_80078884(NA_SE_SY_GET_ITEM);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/func_80B38824.s")
if (this->dropCount == 0) {
this->dropCount++;
}
for (i = this->dropCount; i > 0; i--) {
if (this->itemDrop < WONDERITEM_DROP_RANDOM) {
if ((this->itemDrop == WONDERITEM_DROP_FLEXIBLE) || !autoCollect) {
Item_DropCollectible(globalCtx, &this->actor.posRot.pos, dropTable[this->itemDrop]);
} else {
Item_DropCollectible(globalCtx, &this->actor.posRot.pos, dropTable[this->itemDrop] | 0x8000);
}
} else {
randomDrop = this->itemDrop - WONDERITEM_DROP_RANDOM;
if (!autoCollect) {
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.posRot.pos, randomDrop);
} else {
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.posRot.pos, randomDrop | 0x8000);
}
}
}
if (this->switchFlag >= 0) {
Flags_SetSwitch(globalCtx, this->switchFlag);
}
Actor_Kill(&this->actor);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/func_80B388AC.s")
void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) {
static u32 collisionTypes[] = {
0x00000702 /* sword slash */, 0x0001F820 /* arrow */, 0x00000040 /* hammer */, 0x00000008 /* bomb */,
0x00000004 /* slingshot */, 0x00000010 /* boomerang */, 0x00000080 /* hookshot */,
};
s32 pad;
s16 colTypeIndex;
EnWonderItem* this = THIS;
s16 rotZover10;
s16 tagIndex;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/func_80B38AD8.s")
osSyncPrintf("\n\n");
// Mysterious mystery, very mysterious
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 不思議不思議まか不思議 \t ☆☆☆☆☆ %x\n" VT_RST, this->actor.params);
this->actor.flags &= ~1;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/func_80B38B78.s")
this->wonderMode = (this->actor.params >> 0xB) & 0x1F;
this->itemDrop = (this->actor.params >> 6) & 0x1F;
this->switchFlag = this->actor.params & 0x3F;
if (this->switchFlag == 0x3F) {
this->switchFlag = -1;
}
this->actor.unk_1F = 1;
if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) {
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ☆☆☆☆☆ %d\n" VT_RST, this->switchFlag);
Actor_Kill(&this->actor);
return;
}
switch (this->wonderMode) {
case WONDERITEM_MULTITAG_FREE:
this->numTagPoints = this->actor.posRot.rot.z & 0xF;
rotZover10 = 0;
if (this->actor.posRot.rot.z >= 10) {
rotZover10 = this->actor.posRot.rot.z / 10;
this->timerMod = rotZover10 * 20;
}
this->numTagPoints = this->actor.posRot.rot.z - rotZover10 * 10;
// i.e timerMod = rot.z / 10 seconds, numTagPoints = rot.z % 10
this->updateFunc = EnWonderItem_MultitagFree;
break;
case WONDERITEM_TAG_POINT_FREE:
tagIndex = this->actor.posRot.rot.z & 0xFF;
sTagPointsFree[tagIndex] = this->actor.posRot.pos;
Actor_Kill(&this->actor);
break;
case WONDERITEM_PROXIMITY_DROP:
this->dropCount = this->actor.posRot.rot.z & 0xFF;
this->updateFunc = EnWonderItem_ProximityDrop;
break;
case WONDERITEM_INTERACT_SWITCH:
colTypeIndex = this->actor.posRot.rot.z & 0xFF;
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->collider.body.bumper.flags = collisionTypes[colTypeIndex];
this->collider.dim.radius = 20;
this->collider.dim.height = 30;
this->updateFunc = EnWonderItem_InteractSwitch;
break;
case WONDERITEM_UNUSED:
break;
case WONDERITEM_MULTITAG_ORDERED:
this->numTagPoints = this->actor.posRot.rot.z & 0xF;
rotZover10 = 0;
if (this->actor.posRot.rot.z >= 10) {
rotZover10 = this->actor.posRot.rot.z / 10;
this->timerMod = rotZover10 * 20;
}
this->numTagPoints = this->actor.posRot.rot.z - rotZover10 * 10;
// i.e timerMod = rot.z / 10 seconds, numTagPoints = rot.z % 10
this->updateFunc = EnWonderItem_MultitagOrdered;
break;
case WONDERITEM_TAG_POINT_ORDERED:
tagIndex = this->actor.posRot.rot.z & 0xFF;
sTagPointsOrdered[tagIndex] = this->actor.posRot.pos;
Actor_Kill(&this->actor);
break;
case WONDERITEM_PROXIMITY_SWITCH:
this->updateFunc = EnWonderItem_ProximitySwitch;
break;
case WONDERITEM_BOMB_SOLDIER:
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->collider.body.bumper.flags = 0x00000004; // slingshot
this->unkPos = this->actor.posRot.pos;
this->collider.dim.radius = 35;
this->collider.dim.height = 75;
this->updateFunc = EnWonderItem_BombSoldier;
break;
case WONDERITEM_ROLL_DROP:
this->dropCount = this->actor.posRot.rot.z & 0xFF;
this->updateFunc = EnWonderItem_RollDrop;
break;
default:
Actor_Kill(&this->actor);
break;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/EnWonderItem_Update.s")
void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 prevTagFlags = this->tagFlags;
s32 i;
s32 mask;
for (i = 0, mask = 1; i < this->numTagPoints; i++, mask <<= 1) {
if (!(prevTagFlags & mask)) {
f32 dx = player->actor.posRot.pos.x - sTagPointsFree[i].x;
f32 dy = player->actor.posRot.pos.y - sTagPointsFree[i].y;
f32 dz = player->actor.posRot.pos.z - sTagPointsFree[i].z;
if (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 50.0f) {
this->tagFlags |= mask;
this->tagCount++;
this->timer = this->timerMod + 81;
return;
}
if (BREG(0) != 0) {
DebugDisplay_AddObject(sTagPointsFree[i].x, sTagPointsFree[i].y, sTagPointsFree[i].z,
this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z,
1.0f, 1.0f, 1.0f, 0, 255, 0, 255, 4, globalCtx->state.gfxCtx);
}
}
}
if (this->timer == 1) {
Actor_Kill(&this->actor);
return;
}
if (this->tagCount == this->numTagPoints) {
if (this->switchFlag >= 0) {
Flags_SetSwitch(globalCtx, this->switchFlag);
}
EnWonderItem_DropCollectible(this, globalCtx, true);
}
}
void EnWonderItem_ProximityDrop(EnWonderItem* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if ((this->actor.xzDistFromLink < 50.0f) &&
(fabsf(this->actor.posRot.pos.y - player->actor.posRot.pos.y) < 30.0f)) {
EnWonderItem_DropCollectible(this, globalCtx, true);
}
}
void EnWonderItem_InteractSwitch(EnWonderItem* this, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & 2) {
this->collider.base.acFlags &= ~2;
EnWonderItem_DropCollectible(this, globalCtx, false);
}
}
void EnWonderItem_ProximitySwitch(EnWonderItem* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if ((this->actor.xzDistFromLink < 50.0f) &&
(fabsf(this->actor.posRot.pos.y - player->actor.posRot.pos.y) < 30.0f)) {
if (this->switchFlag >= 0) {
Flags_SetSwitch(globalCtx, this->switchFlag);
}
Actor_Kill(&this->actor);
}
}
void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 prevTagFlags = this->tagFlags;
s32 i;
s32 mask;
for (i = 0, mask = 1; i < this->numTagPoints; i++, mask <<= 1) {
if (!(prevTagFlags & mask)) {
f32 dx = player->actor.posRot.pos.x - sTagPointsOrdered[i].x;
f32 dy = player->actor.posRot.pos.y - sTagPointsOrdered[i].y;
f32 dz = player->actor.posRot.pos.z - sTagPointsOrdered[i].z;
if (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 50.0f) {
if (prevTagFlags & mask) {
return;
} else if (i == this->nextTag) {
this->tagFlags |= mask;
this->tagCount++;
this->nextTag++;
this->timer = this->timerMod + 81;
return;
} else {
Actor_Kill(&this->actor);
return;
}
} else if (BREG(0) != 0) {
DebugDisplay_AddObject(sTagPointsOrdered[i].x, sTagPointsOrdered[i].y, sTagPointsOrdered[i].z,
this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z,
1.0f, 1.0f, 1.0f, 0, 0, 255, 255, 4, globalCtx->state.gfxCtx);
}
}
}
if (this->timer == 1) {
Actor_Kill(&this->actor);
return;
}
if (this->tagCount == this->numTagPoints) {
EnWonderItem_DropCollectible(this, globalCtx, true);
}
}
void EnWonderItem_BombSoldier(EnWonderItem* this, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & 2) {
this->collider.base.acFlags &= ~2;
if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HEISHI2, this->actor.posRot.pos.x,
this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, this->actor.yawTowardsLink, 0,
9) != NULL) {
// Careless soldier spawned
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ うっかり兵セット完了 ☆☆☆☆☆ \n" VT_RST);
}
if (this->switchFlag >= 0) {
Flags_SetSwitch(globalCtx, this->switchFlag);
}
Actor_Kill(&this->actor);
}
}
void EnWonderItem_RollDrop(EnWonderItem* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if ((this->actor.xzDistFromLink < 50.0f) && (player->invincibilityTimer < 0) &&
(fabsf(this->actor.posRot.pos.y - player->actor.posRot.pos.y) < 30.0f)) {
EnWonderItem_DropCollectible(this, globalCtx, true);
}
}
void EnWonderItem_Update(Actor* thisx, GlobalContext* globalCtx) {
static s16 debugArrowColors[] = {
255, 255, 0, 255, 0, 255, 0, 255, 255, 255, 0, 0, 0, 255, 0, 0, 0, 255, 128, 128,
128, 128, 128, 0, 128, 0, 128, 0, 128, 0, 128, 0, 0, 0, 128, 0, 0, 0, 128,
}; // These seem to be mistyped. Logically they should be s16[13][3] and be indexed as [colorIndex][i]
s32 pad;
EnWonderItem* this = THIS;
s32 colorIndex;
if (this->timer != 0) {
this->timer--;
}
this->updateFunc(this, globalCtx);
if (this->wonderMode == WONDERITEM_UNUSED) {
Actor_SetHeight(&this->actor, this->unkHeight);
}
if ((this->wonderMode == WONDERITEM_INTERACT_SWITCH) || (this->wonderMode == WONDERITEM_BOMB_SOLDIER)) {
Collider_CylinderUpdate(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
colorIndex = this->wonderMode;
if (this->wonderMode > 12) {
colorIndex = 0;
}
if (BREG(0) != 0) {
DebugDisplay_AddObject(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z,
this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z, 1.0f, 1.0f,
1.0f, debugArrowColors[colorIndex], debugArrowColors[colorIndex + 1],
debugArrowColors[colorIndex + 2], 255, 4, globalCtx->state.gfxCtx);
}
}

View file

@ -6,11 +6,58 @@
struct EnWonderItem;
typedef void (*EnWonderItemUpdateFunc)(struct EnWonderItem*, GlobalContext*);
typedef struct EnWonderItem {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x84];
/* 0x014C */ EnWonderItemUpdateFunc updateFunc;
/* 0x0150 */ f32 unkHeight; // sets height of dummied out mode 4
/* 0x0154 */ s16 wonderMode;
/* 0x0156 */ s16 itemDrop;
/* 0x0158 */ s16 numTagPoints;
/* 0x015A */ s16 dropCount;
/* 0x015C */ s16 timer;
/* 0x015E */ s16 tagFlags;
/* 0x015A */ s16 tagCount;
/* 0x0162 */ s16 switchFlag;
/* 0x0164 */ char unk_164[4];
/* 0x0168 */ s16 nextTag;
/* 0x016A */ s16 timerMod;
/* 0x016C */ Vec3f unkPos; // set to initial position by mode bomb soldier, then never used.
/* 0x0178 */ char unk_178[8];
/* 0x0180 */ ColliderCylinder collider;
/* 0x01CC */ char unk_1CC[4];
} EnWonderItem; // size = 0x01D0
typedef enum {
/* 0 */ WONDERITEM_MULTITAG_FREE,
/* 1 */ WONDERITEM_TAG_POINT_FREE,
/* 2 */ WONDERITEM_PROXIMITY_DROP,
/* 3 */ WONDERITEM_INTERACT_SWITCH,
/* 4 */ WONDERITEM_UNUSED,
/* 5 */ WONDERITEM_MULTITAG_ORDERED,
/* 6 */ WONDERITEM_TAG_POINT_ORDERED,
/* 7 */ WONDERITEM_PROXIMITY_SWITCH,
/* 8 */ WONDERITEM_BOMB_SOLDIER,
/* 9 */ WONDERITEM_ROLL_DROP
} EnWonderItemMode;
typedef enum {
/* 0 */ WONDERITEM_DROP_NUTS,
/* 1 */ WONDERITEM_DROP_HEART_PIECE,
/* 2 */ WONDERITEM_DROP_MAGIC_LARGE,
/* 3 */ WONDERITEM_DROP_MAGIC_SMALL,
/* 4 */ WONDERITEM_DROP_HEART,
/* 5 */ WONDERITEM_DROP_ARROWS_SMALL,
/* 6 */ WONDERITEM_DROP_ARROWS_MEDIUM,
/* 7 */ WONDERITEM_DROP_ARROWS_LARGE,
/* 8 */ WONDERITEM_DROP_GREEN_RUPEE,
/* 9 */ WONDERITEM_DROP_BLUE_RUPEE,
/* A */ WONDERITEM_DROP_RED_RUPEE,
/* B */ WONDERITEM_DROP_FLEXIBLE,
/* C */ WONDERITEM_DROP_RANDOM
} EnWonderItemDrop;
extern const ActorInit En_Wonder_Item_InitVars;
#endif

View file

@ -33,46 +33,50 @@ const ActorInit En_Wonder_Talk2_InitVars = {
NULL,
};
s16 D_80B3A8E0[] = { 0x6, 0x0, 0x1, 0x2, 0x3, 0x4, 0x5 };
s16 D_80B3A8E0[] = { 6, 0, 1, 2, 3, 4, 5 };
void EnWonderTalk2_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnWonderTalk2* this = THIS;
s32 offsetCounter;
s16 zOffset;
osSyncPrintf("\n\n");
// Transparent message
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 透明メッセージ君 ☆☆☆☆☆ %x\n" VT_RST, this->actor.params);
this->unk_150 = (this->actor.params >> 6) & 0xFF;
this->baseMsgId = (this->actor.params >> 6) & 0xFF;
if (this->actor.posRot.rot.z > 0) {
offsetCounter = 0;
zOffset = this->actor.posRot.rot.z;
s32 rangeIndex = 0;
s16 rotZmod10 = this->actor.posRot.rot.z;
while (zOffset > 10) {
zOffset -= 10;
offsetCounter += 1;
while (rotZmod10 > 10) {
rotZmod10 -= 10;
rangeIndex++;
}
// rangeIndex = rot.z/10 here
this->triggerRange = rotZmod10 * 40.0f;
if (rangeIndex > 6) {
rangeIndex = 0;
}
this->unk_15C = zOffset * 40.0f;
if (offsetCounter > 6) {
offsetCounter = 0;
}
this->actor.unk_1F = D_80B3A8E0[offsetCounter];
this->actor.unk_1F = D_80B3A8E0[rangeIndex];
osSyncPrintf("\n\n");
// originally?
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 元は? ☆☆☆☆☆ %d\n" VT_RST, this->actor.posRot.rot.z);
// The range is?
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ レンジは? ☆☆☆☆☆ %d\n" VT_RST, this->actor.unk_1F);
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ は、範囲わ? ☆☆☆☆☆ %f\n" VT_RST, this->unk_15C);
// Is the range?
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ は、範囲わ? ☆☆☆☆☆ %f\n" VT_RST, this->triggerRange);
osSyncPrintf("\n\n");
osSyncPrintf("\n\n");
osSyncPrintf("\n\n");
}
this->posRot = this->actor.posRot.pos;
this->initPos = this->actor.posRot.pos;
this->switchFlag = (this->actor.params & 0x3F);
this->unk_154 = ((this->actor.params >> 0xE) & 3);
this->talkMode = ((this->actor.params >> 0xE) & 3);
if (this->switchFlag == 0x3F) {
this->switchFlag = -1;
@ -82,14 +86,14 @@ void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_Kill(&this->actor);
return;
}
if ((this->unk_154 == 1) && (globalCtx->sceneNum == SCENE_MEN) && (this->switchFlag != 8) &&
if ((this->talkMode == 1) && (globalCtx->sceneNum == SCENE_MEN) && (this->switchFlag != 0x08) &&
(this->switchFlag != 0x16) && (this->switchFlag != 0x2F)) {
this->unk_15A = 0;
this->unk_154 = 4;
this->unk_15A = false;
this->talkMode = 4;
}
if (this->unk_154 == 3) {
this->actor.flags &= ~0x8000000;
if (this->talkMode == 3) {
this->actor.flags &= ~0x08000000;
this->actionFunc = EnWonderTalk2_DoNothing;
} else {
this->actionFunc = func_80B3A10C;
@ -98,8 +102,8 @@ void EnWonderTalk2_Init(Actor* thisx, GlobalContext* globalCtx) {
void func_80B3A10C(EnWonderTalk2* this, GlobalContext* globalCtx) {
this->actor.textId = 0x200;
this->actor.textId |= this->unk_150;
if (this->unk_154 == 1 || this->unk_154 == 4) {
this->actor.textId |= this->baseMsgId;
if (this->talkMode == 1 || this->talkMode == 4) {
this->actionFunc = func_80B3A4F8;
} else {
this->actionFunc = func_80B3A15C;
@ -107,35 +111,27 @@ void func_80B3A10C(EnWonderTalk2* this, GlobalContext* globalCtx) {
}
void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx) {
Player* player;
Actor* actor;
s16 yawDiff;
s16 yawDiffTemp;
Player* player = PLAYER;
actor = &this->actor;
player = PLAYER;
this->unk_158++;
if (this->switchFlag >= 0 && Flags_GetSwitch(globalCtx, this->switchFlag)) {
if (this->unk_15A == 0) {
this->actor.flags &= -2;
this->unk_15A = 1;
if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) {
if (!this->unk_15A) {
this->actor.flags &= ~1;
this->unk_15A = true;
}
} else if (func_8002F194(&this->actor, globalCtx)) {
if ((this->switchFlag >= 0) && (this->talkMode != 2)) {
Flags_SetSwitch(globalCtx, this->switchFlag);
// I saved it! All of it!
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ セーブしたよ!おもいっきり! %x\n" VT_RST, this->switchFlag);
}
this->actionFunc = func_80B3A10C;
} else {
if (func_8002F194(&this->actor, globalCtx) != 0) {
if ((this->switchFlag >= 0) && (this->unk_154 != 2)) {
Flags_SetSwitch(globalCtx, this->switchFlag);
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ セーブしたよ!おもいっきり! %x\n" VT_RST, this->switchFlag);
}
s16 yawDiff = ABS((s16)(this->actor.yawTowardsLink - this->actor.posRot.rot.y));
this->actionFunc = func_80B3A10C;
return;
}
yawDiffTemp = this->actor.yawTowardsLink - this->actor.posRot.rot.y;
yawDiff = ABS(yawDiffTemp);
if ((!((40.0f + this->unk_15C) < (*actor).xzDistFromLink)) &&
((!(fabsf(player->actor.posRot.pos.y - (*actor).posRot.pos.y) > 100.0f)) && (yawDiff < 0x4000))) {
if (!((this->actor.xzDistFromLink > 40.0f + this->triggerRange) ||
(fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) > 100.0f) || (yawDiff >= 0x4000))) {
if (this->unk_158 >= 2) {
osSyncPrintf("\n\n");
// Transparent Message Kimi Set
@ -143,14 +139,14 @@ void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx) {
// Save Information
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ セーブ情報 \t %x\n" VT_RST, this->switchFlag);
// Specified message type
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 指定メッセージ種類 %x\n" VT_RST, this->unk_150);
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 指定メッセージ種類 %x\n" VT_RST, this->baseMsgId);
// Actual message type
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 実質メッセージ種類 %x\n" VT_RST, this->actor.textId);
// Specified range
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 指定範囲 %d\n" VT_RST, this->actor.posRot.rot.z);
// Processing range
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 処理範囲 %f\n" VT_RST, this->unk_15C);
switch (this->unk_154) {
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 処理範囲 %f\n" VT_RST, this->triggerRange);
switch (this->talkMode) {
case 0:
// Normal
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆ 通常 ☆☆ \n" VT_RST);
@ -167,13 +163,13 @@ void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx) {
}
this->unk_158 = 0;
func_8002F1C4(&this->actor, globalCtx, this->unk_15C + 50.0f, 100.0f, EXCH_ITEM_NONE);
func_8002F1C4(&this->actor, globalCtx, this->triggerRange + 50.0f, 100.0f, EXCH_ITEM_NONE);
}
}
}
void func_80B3A3D4(EnWonderTalk2* this, GlobalContext* globalCtx) {
if (BREG(2)) {
if (BREG(2) != 0) {
// Oh
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ わー %d\n" VT_RST, func_8010BDBC(&globalCtx->msgCtx));
}
@ -189,18 +185,18 @@ void func_80B3A3D4(EnWonderTalk2* this, GlobalContext* globalCtx) {
break;
}
case 0:
if ((this->switchFlag >= 0) && (this->unk_154 != 4)) {
if ((this->switchFlag >= 0) && (this->talkMode != 4)) {
Flags_SetSwitch(globalCtx, this->switchFlag);
// (Forced) I saved! It's all about it!
// (Forced) I saved it! All of it!
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ (強制)セーブしたよ!おもいっきり! %x\n" VT_RST, this->switchFlag);
}
if (this->unk_154 == 4) {
this->unk_15A = 1;
if (this->talkMode == 4) {
this->unk_15A = true;
}
this->actor.flags &= ~0x11;
func_8002DF54(globalCtx, NULL, 7);
this->unk_156 = 1;
this->unk_156 = true;
this->actionFunc = func_80B3A4F8;
break;
}
@ -212,61 +208,59 @@ void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) {
player = PLAYER;
this->unk_158++;
if (this->switchFlag >= 0 && Flags_GetSwitch(globalCtx, this->switchFlag)) {
if (this->unk_15A == 0) {
if (!this->unk_15A) {
this->actor.flags &= ~1;
this->unk_15A = 1;
this->unk_15A = true;
}
} else {
if ((this->unk_154 != 4) || (this->unk_15A == 0)) {
if (BREG(2) != 0) {
// distance
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ きょり %f\n" VT_RST, this->actor.xzDistFromLink);
}
if (((this->actor.xzDistFromLink < (40.0f + this->unk_15C)) &&
(fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) < 100.0f)) &&
!Gameplay_InCsMode(globalCtx)) {
if (this->unk_158 >= 2) {
osSyncPrintf("\n\n");
// Transparent Message Kimi Seto
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 透明メッセージ君せっと %x\n" VT_RST, this->actor.params);
// Save Information
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ セーブ情報 \t %x\n" VT_RST, this->switchFlag);
// Specified message type
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 指定メッセージ種類 %x\n" VT_RST, this->unk_150);
// Real message type
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 実質メッセージ種類 %x\n" VT_RST, this->actor.textId);
// Specified range
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 指定範囲 %d\n" VT_RST, this->actor.posRot.rot.z);
// Processing range
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 処理範囲 %f\n" VT_RST, this->unk_15C);
// What is your range?
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ レンジは? \t\t %d\n" VT_RST, this->actor.unk_1F);
osSyncPrintf("\n\n");
osSyncPrintf("\n\n");
switch (this->unk_154) {
case 1:
// Compulsion
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆ 強制 ☆☆ \n" VT_RST);
break;
case 4:
// Geld Training Center Forced Check Only
osSyncPrintf(VT_FGCOL(RED) " ☆☆ ゲルドの修練場強制チェックのみ ☆☆ \n" VT_RST);
break;
}
osSyncPrintf("\n\n");
}
this->unk_158 = 0;
if (this->unk_156 == 0) {
func_8010B680(globalCtx, this->actor.textId, NULL);
func_8002DF54(globalCtx, NULL, 8);
this->actor.flags |= 0x11;
this->actionFunc = func_80B3A3D4;
} else if ((this->talkMode != 4) || !this->unk_15A) {
if (BREG(2) != 0) {
// distance
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ きょり %f\n" VT_RST, this->actor.xzDistFromLink);
}
if (((this->actor.xzDistFromLink < (40.0f + this->triggerRange)) &&
(fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) < 100.0f)) &&
!Gameplay_InCsMode(globalCtx)) {
if (this->unk_158 >= 2) {
osSyncPrintf("\n\n");
// Transparent Message Kimi Seto
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 透明メッセージ君せっと %x\n" VT_RST, this->actor.params);
// Save Information
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ セーブ情報 \t %x\n" VT_RST, this->switchFlag);
// Specified message type
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 指定メッセージ種類 %x\n" VT_RST, this->baseMsgId);
// Real message type
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 実質メッセージ種類 %x\n" VT_RST, this->actor.textId);
// Specified range
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 指定範囲 %d\n" VT_RST, this->actor.posRot.rot.z);
// Processing range
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 処理範囲 %f\n" VT_RST, this->triggerRange);
// What is your range?
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ レンジは? \t\t %d\n" VT_RST, this->actor.unk_1F);
osSyncPrintf("\n\n");
osSyncPrintf("\n\n");
switch (this->talkMode) {
case 1:
// Compulsion
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆ 強制 ☆☆ \n" VT_RST);
break;
case 4:
// Gerudo Training Grounds Forced Check Only
osSyncPrintf(VT_FGCOL(RED) " ☆☆ ゲルドの修練場強制チェックのみ ☆☆ \n" VT_RST);
break;
}
} else {
this->unk_156 = 0;
osSyncPrintf("\n\n");
}
this->unk_158 = 0;
if (!this->unk_156) {
func_8010B680(globalCtx, this->actor.textId, NULL);
func_8002DF54(globalCtx, NULL, 8);
this->actor.flags |= 0x11;
this->actionFunc = func_80B3A3D4;
}
} else {
this->unk_156 = false;
}
}
}
@ -275,12 +269,14 @@ void EnWonderTalk2_DoNothing(EnWonderTalk2* this, GlobalContext* globalCtx) {
}
void EnWonderTalk2_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnWonderTalk2* this = THIS;
this->actionFunc(this, globalCtx);
this->actor.posRot.pos.y = this->posRot.y;
this->actor.posRot.pos.y = this->initPos.y;
Actor_SetHeight(&this->actor, this->height);
if (BREG(0) != 0) {
if (this->unk_158 != 0) {
if ((this->unk_158 & 1) == 0) {

View file

@ -11,16 +11,16 @@ typedef void (*EnWonderTalk2Func)(struct EnWonderTalk2*, GlobalContext*);
typedef struct EnWonderTalk2 {
/* 0x0000 */ Actor actor;
/* 0x014C */ EnWonderTalk2Func actionFunc;
/* 0x0150 */ s16 unk_150; // specified message type
/* 0x0150 */ s16 baseMsgId; // specified message type
/* 0x0152 */ s16 switchFlag;
/* 0x0154 */ s16 unk_154;
/* 0x0154 */ s16 talkMode;
/* 0x0156 */ s16 unk_156;
/* 0x0158 */ s16 unk_158;
/* 0x015A */ u8 unk_15A;
/* 0x015B */ u8 unk_15B;
/* 0x015C */ f32 unk_15C; // processing range
/* 0x015C */ f32 triggerRange;
/* 0x0160 */ f32 height;
/* 0x0164 */ Vec3f posRot;
/* 0x0164 */ Vec3f initPos;
} EnWonderTalk2; // size = 0x0170
extern const ActorInit En_Wonder_Talk2_InitVars;