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

En_Heishi1 and Eff_Ss_Solder_Srch_Ball OK (#234)

* progress

* init ok and merge master

* enheishi1 and srchball OK

* cleanup

* cleanup

* cleanup

* more cleanup

* done

* more comments

* add file headers

* some review comments

* move vectors

* more review comments

* angle in decimal

* add prototype

* semicolon would be good

* fix

* make unset actor ids 0

* reword comment

* no &
This commit is contained in:
fig02 2020-07-09 15:12:03 -04:00 committed by GitHub
parent b4a7ac9d71
commit 8b6e86649d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 636 additions and 1880 deletions

View file

@ -1,6 +1,53 @@
#include <ultra64.h>
#include <global.h>
/*
* File: z_eff_ss_solder_srch_ball.c
* Overlay: ovl_Effect_Ss_Solder_Srch_Ball
* Description: Vision sphere for courtyard guards
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/func_809AC130.s")
#include "z_eff_ss_solder_srch_ball.h"
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/func_809AC1AC.s")
u32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars = {
EFFECT_SS_SOLDER_SRCH_BALL,
EffectSsSolderSrchBall_Init,
};
u32 EffectSsSolderSrchBall_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
EffectSsSolderSrchBallInitParams* initParams = (EffectSsSolderSrchBallInitParams*)initParamsx;
this->pos = initParams->pos;
this->velocity = initParams->velocity;
this->accel = initParams->accel;
this->update = EffectSsSolderSrchBall_Update;
this->life = 100;
this->regs[1] = initParams->unk_24;
this->unk_3C = initParams->linkDetected;
return 1;
}
void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
s32 pad;
f32 playerPosDiffX;
f32 playerPosDiffY;
f32 playerPosDiffZ;
s16* linkDetected;
Player* player = PLAYER;
linkDetected = this->unk_3C;
playerPosDiffX = player->actor.posRot.pos.x - this->pos.x;
playerPosDiffY = player->actor.posRot.pos.y - this->pos.y;
playerPosDiffZ = player->actor.posRot.pos.z - this->pos.z;
if (!func_8003E30C(&globalCtx->colCtx, &this->pos, 30.0f)) {
if (sqrtf(SQ(playerPosDiffX) + SQ(playerPosDiffY) + SQ(playerPosDiffZ)) < 70.0f) {
*linkDetected = true;
}
} else {
if (this->life > 1) {
this->life = 1;
}
}
}

View file

@ -0,0 +1,15 @@
#ifndef _Z_EFF_SS_SOLDERSRCHBALL_H_
#define _Z_EFF_SS_SOLDERSRCHBALL_H_
#include <ultra64.h>
#include <global.h>
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
/* 0x18 */ Vec3f accel;
/* 0x24 */ s16 unk_24;
/* 0x28 */ s16* linkDetected;
} EffectSsSolderSrchBallInitParams;
#endif