mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 14:50:15 +00:00
Format all src C files
This commit is contained in:
parent
251aea64ab
commit
8cfe7cce9f
652 changed files with 12488 additions and 19093 deletions
|
@ -1,3 +1 @@
|
|||
#include "dlists.h"
|
||||
|
||||
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
* File: z_en_ms.c
|
||||
* Overlay: ovl_En_Ms
|
||||
* Description: Magic Bean Salesman
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ SkelAnime skelAnime;
|
||||
/* 0x0190 */ UNK_PTR unkSkelAnimeStruct;
|
||||
|
@ -20,7 +19,7 @@ typedef struct
|
|||
/* 0x024C */ s16 activeTimer;
|
||||
} EnMs; // size = 0x0250
|
||||
|
||||
#define ROOM 0x00
|
||||
#define ROOM 0x00
|
||||
#define FLAGS 0x00000009
|
||||
|
||||
static void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx);
|
||||
|
@ -33,8 +32,7 @@ static void EnMs_TalkAfterBuy(EnMs* this, GlobalContext* globalCtx);
|
|||
static void EnMs_Update(EnMs* this, GlobalContext* globalCtx);
|
||||
static void EnMs_Draw(EnMs* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit En_Ms_InitVars =
|
||||
{
|
||||
const ActorInit En_Ms_InitVars = {
|
||||
ACTOR_EN_MS,
|
||||
ACTORTYPE_NPC,
|
||||
ROOM,
|
||||
|
@ -47,43 +45,31 @@ const ActorInit En_Ms_InitVars =
|
|||
(ActorFunc)EnMs_Draw,
|
||||
};
|
||||
|
||||
static s32 unk_col_80AB0320[] =
|
||||
{
|
||||
0x0A000939, 0x01000000,
|
||||
0x00000000, 0x00000000,
|
||||
0x00000000, 0xFFCFFFFF,
|
||||
0x00000000, 0x00010100,
|
||||
0x00160025, 0x00000000,
|
||||
0x00000000
|
||||
static s32 unk_col_80AB0320[] = {
|
||||
0x0A000939, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0xFFCFFFFF,
|
||||
0x00000000, 0x00010100, 0x00160025, 0x00000000, 0x00000000,
|
||||
};
|
||||
|
||||
static s16 prices[] =
|
||||
{
|
||||
10, 20, 30, 40, 50, 60, 70, 80, 90, 100
|
||||
static s16 prices[] = {
|
||||
10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
|
||||
};
|
||||
|
||||
static u16 offerTextIds[] =
|
||||
{
|
||||
0x405E, 0x405F, 0x4060, 0x4061, 0x4062,
|
||||
0x4063, 0x4064, 0x4065, 0x4066, 0x4067
|
||||
static u16 offerTextIds[] = {
|
||||
0x405E, 0x405F, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, 0x4067,
|
||||
};
|
||||
|
||||
static InitChainEntry initChain[] =
|
||||
{
|
||||
static InitChainEntry initChain[] = {
|
||||
ICHAIN_U8(unk_1F, 2, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(unk_4C, 500, ICHAIN_STOP)
|
||||
ICHAIN_F32(unk_4C, 500, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
extern D_060005EC;
|
||||
extern D_06003DC0;
|
||||
|
||||
static void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx)
|
||||
{
|
||||
static void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx) {
|
||||
this->actor.textId = func_8006C360(globalCtx, 0x1B);
|
||||
if (this->actor.textId == 0)
|
||||
{
|
||||
if (BEANS_BOUGHT >= 10)
|
||||
{
|
||||
if (this->actor.textId == 0) {
|
||||
if (BEANS_BOUGHT >= 10) {
|
||||
this->actor.textId = 0x406B;
|
||||
return;
|
||||
}
|
||||
|
@ -91,19 +77,17 @@ static void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx)
|
|||
}
|
||||
}
|
||||
|
||||
static void EnMs_Init(EnMs* this, GlobalContext* globalCtx)
|
||||
{
|
||||
static void EnMs_Init(EnMs* this, GlobalContext* globalCtx) {
|
||||
s32 pad1;
|
||||
s32 pad2;
|
||||
|
||||
if (LINK_AGE_IN_YEARS != YEARS_CHILD)
|
||||
{
|
||||
if (LINK_AGE_IN_YEARS != YEARS_CHILD) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
Actor_ProcessInitChain(&this->actor, initChain);
|
||||
func_800A46F8(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC,
|
||||
&this->unkSkelAnimeStruct, &this->unk_1C6, 9); //skelanime_mtx_init
|
||||
func_800A46F8(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, &this->unkSkelAnimeStruct, &this->unk_1C6,
|
||||
9); // skelanime_mtx_init
|
||||
ActorCollider_AllocCylinder(globalCtx, &this->collider);
|
||||
func_8005C450(globalCtx, &this->collider, this, &unk_col_80AB0320);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 35.0f);
|
||||
|
@ -119,70 +103,57 @@ static void EnMs_Init(EnMs* this, GlobalContext* globalCtx)
|
|||
this->actionFunc = EnMs_Wait;
|
||||
}
|
||||
|
||||
static void EnMs_Destroy(EnMs* this, GlobalContext* globalCtx)
|
||||
{
|
||||
static void EnMs_Destroy(EnMs* this, GlobalContext* globalCtx) {
|
||||
ColliderCylinderMain* collider = &this->collider;
|
||||
ActorCollider_FreeCylinder(globalCtx, collider);
|
||||
}
|
||||
|
||||
static void EnMs_Wait(EnMs* this, GlobalContext* globalCtx)
|
||||
{
|
||||
static void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) {
|
||||
s16 unkAngle;
|
||||
|
||||
unkAngle = this->actor.rotTowardsLinkY - this->actor.shape.rot.y;
|
||||
EnMs_SetOfferText(&this->actor, globalCtx);
|
||||
if (func_8002F194(&this->actor, globalCtx) != 0) //if talk is initiated
|
||||
{
|
||||
if (func_8002F194(&this->actor, globalCtx) != 0) { // if talk is initiated
|
||||
this->actionFunc = &EnMs_Talk;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((this->actor.xzDistanceFromLink < 90.0f) && (ABS(unkAngle) < 0x2000)) //talk range
|
||||
{
|
||||
if ((this->actor.xzDistanceFromLink < 90.0f) && (ABS(unkAngle) < 0x2000)) { // talk range
|
||||
func_8002F2CC(&this->actor, globalCtx, 90.0f);
|
||||
}
|
||||
}
|
||||
|
||||
static void EnMs_Talk(EnMs* this, GlobalContext* globalCtx)
|
||||
{
|
||||
static void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) {
|
||||
u8 dialogState;
|
||||
|
||||
dialogState = func_8010BDBC(&globalCtx->msgCtx);
|
||||
if (dialogState != 4)
|
||||
{
|
||||
if ((dialogState == 6) && (func_80106BC8(globalCtx) != 0)) //advanced final textbox
|
||||
{
|
||||
if (dialogState != 4) {
|
||||
if ((dialogState == 6) && (func_80106BC8(globalCtx) != 0)) { // advanced final textbox
|
||||
this->actionFunc = &EnMs_Wait;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(func_80106BC8(globalCtx) != 0)
|
||||
{
|
||||
switch (globalCtx->msgCtx.choiceIndex)
|
||||
{
|
||||
case 0: //yes
|
||||
if (gSaveContext.rupees < prices[BEANS_BOUGHT])
|
||||
{
|
||||
func_8010B720(globalCtx, 0x4069); //not enough rupees text
|
||||
} else {
|
||||
if (func_80106BC8(globalCtx) != 0) {
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
case 0: // yes
|
||||
if (gSaveContext.rupees < prices[BEANS_BOUGHT]) {
|
||||
func_8010B720(globalCtx, 0x4069); // not enough rupees text
|
||||
return;
|
||||
}
|
||||
func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f);
|
||||
this->actionFunc = &EnMs_Sell;
|
||||
return;
|
||||
case 1: //no
|
||||
case 1: // no
|
||||
func_8010B720(globalCtx, 0x4068);
|
||||
default: return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void EnMs_Sell(EnMs* this, GlobalContext* globalCtx)
|
||||
{
|
||||
if (func_8002F410(&this->actor, globalCtx) != 0) //if attached is set
|
||||
{
|
||||
Rupees_ChangeBy(-prices[BEANS_BOUGHT]); //decrease ruppees
|
||||
static void EnMs_Sell(EnMs* this, GlobalContext* globalCtx) {
|
||||
if (func_8002F410(&this->actor, globalCtx) != 0) { // if attached is set
|
||||
Rupees_ChangeBy(-prices[BEANS_BOUGHT]); // decrease ruppees
|
||||
this->actor.attachedA = NULL;
|
||||
this->actionFunc = &EnMs_TalkAfterBuy;
|
||||
return;
|
||||
|
@ -190,18 +161,15 @@ static void EnMs_Sell(EnMs* this, GlobalContext* globalCtx)
|
|||
func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f);
|
||||
}
|
||||
|
||||
static void EnMs_TalkAfterBuy(EnMs* this, GlobalContext* globalCtx)
|
||||
{
|
||||
//if dialog state is 6 and player responded to textbox
|
||||
if ((func_8010BDBC(&globalCtx->msgCtx)) == 6 && (func_80106BC8(globalCtx) != 0))
|
||||
{
|
||||
static void EnMs_TalkAfterBuy(EnMs* this, GlobalContext* globalCtx) {
|
||||
// if dialog state is 6 and player responded to textbox
|
||||
if ((func_8010BDBC(&globalCtx->msgCtx)) == 6 && (func_80106BC8(globalCtx) != 0)) {
|
||||
func_8010B720(globalCtx, 0x406C);
|
||||
this->actionFunc = &EnMs_Talk;
|
||||
}
|
||||
}
|
||||
|
||||
static void EnMs_Update(EnMs* this, GlobalContext* globalCtx)
|
||||
{
|
||||
static void EnMs_Update(EnMs* this, GlobalContext* globalCtx) {
|
||||
s32 pad1;
|
||||
s32 pad2;
|
||||
|
||||
|
@ -212,8 +180,7 @@ static void EnMs_Update(EnMs* this, GlobalContext* globalCtx)
|
|||
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
|
||||
this->actionFunc(this, globalCtx);
|
||||
|
||||
if (gSaveContext.entrance_index == 0x157 && gSaveContext.scene_setup_index == 8) //ride carpet if in credits
|
||||
{
|
||||
if (gSaveContext.entrance_index == 0x157 && gSaveContext.scene_setup_index == 8) { // ride carpet if in credits
|
||||
Actor_MoveForward(&this->actor);
|
||||
osSyncPrintf("OOOHHHHHH %f\n", this->actor.velocity.y);
|
||||
func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
|
@ -222,9 +189,8 @@ static void EnMs_Update(EnMs* this, GlobalContext* globalCtx)
|
|||
Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider);
|
||||
}
|
||||
|
||||
void EnMs_Draw(EnMs* this, GlobalContext* globalCtx)
|
||||
{
|
||||
void EnMs_Draw(EnMs* this, GlobalContext* globalCtx) {
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl,
|
||||
this->skelAnime.dListCount, 0, 0, &this->actor);
|
||||
func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, 0, 0,
|
||||
&this->actor);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue