Merge branch 'master' of https://github.com/zeldaret/oot into ovl_Bg_toki_swd

This commit is contained in:
shawlucas
2020-03-21 20:38:59 -07:00
139 changed files with 941 additions and 1643 deletions
+2 -2
View File
@@ -121,8 +121,8 @@ Vec3f* func_8007C4E0(Vec3f* dest, Vec3f* a, Vec3f* b)
{
Vec3f var;
var.x = func_800FD250(b->z - a->z, b->y - a->y);
var.y = func_800FD250(b->x - a->x, b->z - a->z);
var.x = Math_atan2f(b->z - a->z, b->y - a->y);
var.y = Math_atan2f(b->x - a->x, b->z - a->z);
var.z = 0;
*dest = var;
+131
View File
@@ -0,0 +1,131 @@
#include <global.h>
typedef struct
{
/* 0x00 */ u32 type;
/* 0x04 */ u32 setScissor;
/* 0x08 */ union
{
Color_RGBA8 c;
u32 rgba;
} color;
/* 0x0C */ u32 unk_0C;
} struct_801664F0;
Gfx D_8012AC00[] =
{
gsDPSetOtherMode(
G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP |
G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2),
gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1),
gsDPPipeSync(),
gsDPSetBlendColor(0, 0, 0, 8),
gsSPEndDisplayList(),
};
Gfx D_8012AC28[] =
{
gsDPSetOtherMode(
G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP |
G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL |
GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG,G_BL_CLR_MEM, G_BL_A_MEM) |
GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)),
gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1),
gsSPEndDisplayList(),
};
Gfx D_8012AC40[] =
{
gsDPSetOtherMode(
G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP |
G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL |
GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) |
GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)),
gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1),
gsSPEndDisplayList(),
};
Gfx D_8012AC58[] =
{
gsDPSetCombineLERP(K5, K5, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, K5, K5, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE),
gsDPSetOtherMode(
G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP |
G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2),
gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1),
gsDPSetOtherMode(
G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP |
G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL |
GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) |
GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)),
gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1),
gsSPEndDisplayList(),
};
//Init func
void func_800ACE70(struct_801664F0* this)
{
this->type = 0;
this->setScissor = false;
this->color.c.r = 0xFF;
this->color.c.g = 0xFF;
this->color.c.b = 0xFF;
this->color.c.a = 0xFF;
}
//Destroy func
void func_800ACE90(struct_801664F0* this)
{
}
//Update func
void func_800ACE98(struct_801664F0* this, Gfx** gfxp)
{
Gfx* gfx;
gfx = *gfxp;
gDPPipeSync(gfx++);
gDPSetPrimDepth(gfx++, -1, -1);
if (this->setScissor == true)
{
gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
}
switch(this->type)
{
case 1:
{
gSPDisplayList(gfx++, D_8012AC40);
break;
}
case 2:
{
gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba);
gSPDisplayList(gfx++, D_8012AC58);
break;
}
case 3:
{
gDPSetColor(gfx++, G_SETBLENDCOLOR, this->color.rgba);
gSPDisplayList(gfx++, D_8012AC00);
break;
}
case 4:
{
gDPSetColor(gfx++, G_SETFOGCOLOR, this->color.rgba);
gSPDisplayList(gfx++, D_8012AC28);
break;
}
}
gDPPipeSync(gfx++);
*gfxp = gfx;
}
+229
View File
@@ -0,0 +1,229 @@
#include <ultra64.h>
#include <global.h>
#include <fp.h>
s32 use_cfrac;
f32 Math_tanf(f32 x)
{
f32 sin = sinf(x);
f32 cos = cosf(x);
return sin / cos;
}
f32 Math_floorf(f32 x)
{
return floorf(x);
}
f32 Math_ceilf(f32 x)
{
return ceilf(x);
}
f32 Math_roundf(f32 x)
{
return roundf(x);
}
f32 Math_truncf(f32 x)
{
return truncf(x);
}
f32 Math_nearbyintf(f32 x)
{
return nearbyintf(x);
}
/* Arctangent approximation using a Taylor series (one quadrant) */
f32 Math_atanf_taylor_q(f32 x)
{
static const f32 coeffs[] =
{
-1.f / 3,
+1.f / 5,
-1.f / 7,
+1.f / 9,
-1.f / 11,
+1.f / 13,
-1.f / 15,
+1.f / 17,
0.f,
};
f32 poly = x;
f32 sq = SQ(x);
f32 exp = x * sq;
const f32 *c = coeffs;
f32 term;
while (1)
{
term = *c++ * exp;
if (poly + term == poly)
{
break;
}
poly = poly + term;
exp = exp * sq;
}
return poly;
}
/* Ditto for two quadrants */
f32 Math_atanf_taylor(f32 x)
{
f32 t;
f32 q;
if (x > 0.f)
{
t = x;
}
else if (x < 0.f)
{
t = -x;
}
else if (x == 0.f)
{
return 0.f;
}
else
{
return qNaN0x10000;
}
if (t <= M_SQRT2 - 1.f)
{
return Math_atanf_taylor_q(x);
}
if (t >= M_SQRT2 + 1.f)
{
q = M_PI / 2 - Math_atanf_taylor_q(1.f / t);
}
else
{
q = M_PI / 4 - Math_atanf_taylor_q((1.f - t) / (1.f + t));
}
if (x > 0.f)
{
return q;
}
else
{
return -q;
}
}
/* Arctangent approximation using a continued fraction */
f32 Math_atanf_cfrac(f32 x)
{
s32 sector;
f32 z;
f32 conv;
f32 sq;
s32 i;
if (x >= -1.f && x <= 1.f)
{
sector = 0;
}
else if (x > 1.f)
{
sector = 1;
x = 1.f / x;
}
else if (x < -1.f)
{
sector = -1;
x = 1.f / x;
}
else
{
return qNaN0x10000;
}
sq = SQ(x);
conv = 0.f;
z = 8.f;
for (i = 8; i != 0; i--)
{
conv = SQ(z) * sq / (2.f * z + 1.f + conv);
z -= 1.f;
}
conv = x / (1.f + conv);
if (sector == 0)
{
return conv;
}
else if (sector > 0)
{
return M_PI / 2 - conv;
}
else
{
return -M_PI / 2 - conv;
}
}
f32 Math_atanf(f32 x)
{
if (use_cfrac == 0)
{
return Math_atanf_taylor(x);
}
else
{
return Math_atanf_cfrac(x);
}
}
f32 Math_atan2f(f32 y, f32 x)
{
if (x == 0.f)
{
if (y == 0.f)
{
return 0.f;
}
else if (y > 0.f)
{
return M_PI / 2;
}
else if (y < 0.f)
{
return -M_PI / 2;
}
else
{
return qNaN0x10000;
}
}
else if (x >= 0.f)
{
return Math_atanf(y / x);
}
else if (y < 0.f)
{
return Math_atanf(y / x) - M_PI;
}
else
{
return M_PI - Math_atanf(-(y / x));
}
}
f32 Math_asinf(f32 x)
{
return Math_atan2f(x, sqrtf(1.f - SQ(x)));
}
f32 Math_acosf(f32 x)
{
return M_PI / 2 - Math_asinf(x);
}
+12 -12
View File
@@ -792,22 +792,22 @@ void func_800D1FD4(MtxF* mf)
// same differences as func_800D2264
void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag)
{
vec->x = func_800FD250(-mf->zy, sqrtf(SQ(mf->zx) + SQ(mf->zz))) * (32768 / M_PI);
vec->x = Math_atan2f(-mf->zy, sqrtf(SQ(mf->zx) + SQ(mf->zz))) * (32768 / M_PI);
if ((vec->x == 0x4000) || (vec->x == -0x4000))
{
vec->z = 0;
vec->y = func_800FD250(-mf->xz, mf->xx) * (32768 / M_PI);
vec->y = Math_atan2f(-mf->xz, mf->xx) * (32768 / M_PI);
return;
}
vec->y = func_800FD250(mf->zx, mf->zz) * (32768 / M_PI);
vec->y = Math_atan2f(mf->zx, mf->zz) * (32768 / M_PI);
if (!flag)
vec->z = func_800FD250(mf->xy, mf->yy) * (32768 / M_PI);
vec->z = Math_atan2f(mf->xy, mf->yy) * (32768 / M_PI);
else
vec->z = func_800FD250(mf->xy / sqrtf(SQ(mf->xx) + SQ(mf->xz) + SQ(mf->xy)),
mf->yy / sqrtf(SQ(mf->yx) + SQ(mf->yz) + SQ(mf->yy))) * (32768 / M_PI);
vec->z = Math_atan2f(mf->xy / sqrtf(SQ(mf->xx) + SQ(mf->xz) + SQ(mf->xy)),
mf->yy / sqrtf(SQ(mf->yx) + SQ(mf->yz) + SQ(mf->yy))) * (32768 / M_PI);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_800D20CC.s")
@@ -817,22 +817,22 @@ void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag)
// same differences as func_800D20CC
void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag)
{
vec->y = func_800FD250(-mf->xz, sqrtf(SQ(mf->xx) + SQ(mf->xy))) * (32768 / M_PI);
vec->y = Math_atan2f(-mf->xz, sqrtf(SQ(mf->xx) + SQ(mf->xy))) * (32768 / M_PI);
if ((vec->y == 0x4000) || (vec->y == -0x4000))
{
vec->x = 0;
vec->z = func_800FD250(-mf->yx, mf->yy) * (32768 / M_PI);
vec->z = Math_atan2f(-mf->yx, mf->yy) * (32768 / M_PI);
return;
}
vec->z = func_800FD250(mf->xy, mf->xx) * (32768 / M_PI);
vec->z = Math_atan2f(mf->xy, mf->xx) * (32768 / M_PI);
if (!flag)
vec->x = func_800FD250(mf->yz, mf->zz) * (32768 / M_PI);
vec->x = Math_atan2f(mf->yz, mf->zz) * (32768 / M_PI);
else
vec->x = func_800FD250(mf->yz / sqrtf(SQ(mf->yx) + SQ(mf->yy) + SQ(mf->yz)),
mf->zz / sqrtf(SQ(mf->zx) + SQ(mf->zy) + SQ(mf->zz))) * (32768 / M_PI);
vec->x = Math_atan2f(mf->yz / sqrtf(SQ(mf->yx) + SQ(mf->yy) + SQ(mf->yz)),
mf->zz / sqrtf(SQ(mf->zx) + SQ(mf->zy) + SQ(mf->zz))) * (32768 / M_PI);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_800D2264.s")
+3 -3
View File
@@ -88,7 +88,7 @@ void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3,
gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0, 0, 0,
(u32)(((arg3 * 0.00005f) > 1.0f ? 1.0f : (arg3 * 0.00005f)) * arg4) & 0xFF);
sp58 = func_800FD250(light->l.dir[0], light->l.dir[2]);
sp58 = Math_atan2f(light->l.dir[0], light->l.dir[2]);
arg6 *= (4.5f - (light->l.dir[1] * 0.035f));
arg6 = (arg6 < 1.0f) ? 1.0f : arg6;
Matrix_Put(arg2);
@@ -4688,12 +4688,12 @@ void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2)
sp38 = Math_Sins(arg1);
sp34 = Math_Coss(arg1);
sp28 = (-(sp44 * sp38) - (sp3C * sp34));
arg2->x = -(s16)(func_800FD250(sp28 * sp40, 1.0f) * (32768 / M_PI));
arg2->x = -(s16)(Math_atan2f(sp28 * sp40, 1.0f) * (32768 / M_PI));
sp2C = Math_Sins(arg1 - 16375);
sp30 = Math_Coss(arg1 - 16375);
sp24 = (-(sp44 * sp2C) - (sp3C * sp30));
arg2->z = -(s16)(func_800FD250(sp24 * sp40, 1.0f) * (32768 / M_PI));
arg2->z = -(s16)(Math_atan2f(sp24 * sp40, 1.0f) * (32768 / M_PI));
}
}
+5 -5
View File
@@ -383,7 +383,7 @@ f32 func_800449AC(Camera *camera, Vec3f *b, s32 *arg2)
s16 func_80044A74(Vec3f *a, Vec3f *b)
{
return func_800FD250(b->x - a->x, b->z - a->z) * (180 / M_PI) * (32767.5f / 180) + 0.5f;
return Math_atan2f(b->x - a->x, b->z - a->z) * (180 / M_PI) * (32767.5f / 180) + 0.5f;
}
// 234 lines
@@ -505,7 +505,7 @@ s32 func_800458D4(Camera *camera, struct_80045714 *b, f32 c, f32 *d, s16 e)
sp60.y -= func_80045714(&camera->unk_108, temp_s1->rot.y, b->unk_06, OREG(9));
sp48 = temp_s1->pos.y - *d;
temp_ret = func_800FD250(sp48, func_8007C028(&camera->unk_50, &camera->unk_5C)); // f2 and f14 are swapped
temp_ret = Math_atan2f(sp48, func_8007C028(&camera->unk_50, &camera->unk_5C)); // f2 and f14 are swapped
if (OREG(32) * (M_PI / 180) < temp_ret)
phi_f2 = 1.0f - sinf(temp_ret - OREG(32) * (M_PI / 180));
@@ -600,8 +600,8 @@ s32 func_80045C74(Camera *camera, struct_80045714 *b, f32 c, f32 *d, s16 arg4)
if (PREG(75) == 0)
{
sp54 = func_8007C028(&camera->unk_50, &camera->unk_5C);
func_800FD250(temp, sp54);
temp_f2 = func_800FCE80(camera->unk_FC * 0.4f * (M_PI / 180)) * sp54;
Math_atan2f(temp, sp54);
temp_f2 = Math_tanf(camera->unk_FC * 0.4f * (M_PI / 180)) * sp54;
if (temp > temp_f2)
{
@@ -621,7 +621,7 @@ s32 func_80045C74(Camera *camera, struct_80045714 *b, f32 c, f32 *d, s16 arg4)
}
else
{
temp_ret_3 = func_800FD250(temp, func_8007C028(&camera->unk_50, &camera->unk_5C));
temp_ret_3 = Math_atan2f(temp, func_8007C028(&camera->unk_50, &camera->unk_5C));
if (OREG(32) * (M_PI / 180) < temp_ret_3)
phi_f16 = 1.0f - sinf(temp_ret_3 - OREG(32) * (M_PI / 180));
+189 -21
View File
@@ -1,14 +1,38 @@
/*
* File: z_demo_geff.c
* Overlay: Demo_Geff
* Description:
*/
#include "z_demo_geff.h"
#include <vt.h>
#define ROOM 0x00
#define FLAGS 0x00000030
void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx);
void DemoGeff_Destroy(DemoGeff* this, GlobalContext* globalCtx);
void DemoGeff_Update(DemoGeff* this, GlobalContext* globalCtx);
void DemoGeff_Draw(DemoGeff* this, GlobalContext* globalCtx);
static void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx);
static void DemoGeff_Destroy(DemoGeff* this, GlobalContext* globalCtx);
static void DemoGeff_Update(DemoGeff* this, GlobalContext* globalCtx);
static void DemoGeff_Draw(DemoGeff* this, GlobalContext* globalCtx);
static void func_80978030(DemoGeff* this, GlobalContext* globalCtx);
static void func_809783D4(DemoGeff* this, GlobalContext* globalCtx);
static void func_80978308(DemoGeff* this, GlobalContext* globalCtx);
static void func_809784D4(DemoGeff* this, GlobalContext* globalCtx);
static void func_80978344(DemoGeff* this, GlobalContext* globalCtx);
s16 objectIds[] = { OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF,
OBJECT_GEFF, OBJECT_GEFF, };
ActorFunc scaleFuncs[] = { (ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030,
(ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030,
(ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030, };
ActorFunc actionFuncs[] = { (ActorFunc)func_809783D4, (ActorFunc)func_80978308, };
ActorFunc drawFuncs[] = { (ActorFunc)func_809784D4, (ActorFunc)func_80978344, };
/*
const ActorInit Demo_Geff_InitVars =
{
ACTOR_DEMO_GEFF,
@@ -22,33 +46,177 @@ const ActorInit Demo_Geff_InitVars =
(ActorFunc)DemoGeff_Update,
(ActorFunc)DemoGeff_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Destroy.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Init.s")
extern UNK_TYPE D_06000EA0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80977EA8.s")
static void DemoGeff_Destroy(DemoGeff* this, GlobalContext* globalCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80977F80.s")
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978030.s")
static void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx) {
if (this->actor.params < 0 || this->actor.params >= 9) {
osSyncPrintf(VT_FGCOL(RED) "Demo_Geff_Actor_ct:arg_dataがおかしい!!!!!!!!!!!!\n" VT_RST);
Actor_Kill(&this->actor);
return;
}
this->action = 0;
this->drawConfig = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809780E0.s")
static void func_80977EA8(GlobalContext* globalCtx, u32 dlist) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809781FC.s")
func_800C6AC4(gfxArr, gfxCtx, "../z_demo_geff.c", 181);
func_80093D18(gfxCtx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809782A0.s")
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(gfxCtx, "../z_demo_geff.c", 183),
G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyOpa.p++, dlist);
gSPPopMatrix(gfxCtx->polyOpa.p++, G_MTX_MODELVIEW);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978308.s")
func_800C6B54(gfxArr, gfxCtx, "../z_demo_geff.c", 188);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978344.s")
static void func_80977F80(DemoGeff* this, GlobalContext* globalCtx) {
s32 pad[2];
s32 objBankIndex = this->objBankIndex;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978370.s")
func_800C6AC4(gfxArr, gfxCtx, "../z_demo_geff.c", 204);
gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment);
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objBankIndex].segment);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809783D4.s")
// Necessary to match
if (!globalCtx) {}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Update.s")
func_800C6B54(gfxArr, gfxCtx, "../z_demo_geff.c", 212);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809784D4.s")
static void func_80978030(DemoGeff* this, GlobalContext* globalCtx) {
Vec3f* thisScale = &this->actor.scale;
this->action = 1;
this->drawConfig = 1;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Draw.s")
switch (this->actor.params) {
case 0:
case 3:
case 6:
thisScale->x = (kREG(7) * 0.01f) + 0.3f;
thisScale->y = (kREG(8) * 0.01f) + 0.3f;
thisScale->z = (kREG(9) * 0.01f) + 0.3f;
break;
case 1:
case 4:
case 7:
thisScale->x = (kREG(10) * 0.01f) + 0.15f;
thisScale->y = (kREG(11) * 0.01f) + 0.29f;
thisScale->z = (kREG(12) * 0.01f) + 0.12f;
break;
default:
thisScale->x = (kREG(13) * 0.01f) + 0.1f;
thisScale->y = (kREG(14) * 0.01f) + 0.15f;
thisScale->z = (kREG(15) * 0.01f) + 0.2f;
break;
}
}
static void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) {
s32 targetParams = 2;
Actor* propIt;
if (this->demoGt == NULL) {
propIt = globalCtx->actorCtx.actorList[ACTORTYPE_PROP].first;
if ((this->actor.params != 0) && (this->actor.params != 1) && (this->actor.params != 2)) {
targetParams = 2;
} else {
targetParams = 1;
}
while (propIt != NULL) {
if (propIt->id == ACTOR_DEMO_GT && propIt->params == targetParams) {
this->deltaPosX = this->actor.posRot.pos.x - propIt->posRot.pos.x;
this->deltaPosY = this->actor.posRot.pos.y - propIt->posRot.pos.y;
this->deltaPosZ = this->actor.posRot.pos.z - propIt->posRot.pos.z;
this->demoGt = propIt;
}
propIt = propIt->next;
}
}
}
static void func_809782A0(DemoGeff* this, GlobalContext* globalCtx) {
DemoGt* demoGt = this->demoGt;
s16 params = this->actor.params;
if (demoGt != NULL && (params != 6) && (params != 7) && (params != 8)) {
this->actor.posRot.pos.x = demoGt->actor.posRot.pos.x + this->deltaPosX;
this->actor.posRot.pos.y = demoGt->actor.posRot.pos.y + this->deltaPosY;
this->actor.posRot.pos.z = demoGt->actor.posRot.pos.z + this->deltaPosZ;
}
}
static void func_80978308(DemoGeff* this, GlobalContext* globalCtx) {
func_809781FC(this, globalCtx);
func_809782A0(this, globalCtx);
func_80978030(this, globalCtx);
}
static void func_80978344(DemoGeff* this, GlobalContext* globalCtx) {
func_80977EA8(globalCtx, &D_06000EA0);
}
static void func_80978370(DemoGeff* this, GlobalContext* globalCtx) {
s16 params = this->actor.params;
ActorFunc actorFunc = scaleFuncs[params];
if (actorFunc == NULL) {
osSyncPrintf(VT_FGCOL(RED) " Demo_Geff_main_init:初期化処理がおかしいarg_data = %d!\n" VT_RST, params);
Actor_Kill(&this->actor);
return;
}
actorFunc(this, globalCtx);
}
static void func_809783D4(DemoGeff* this, GlobalContext* globalCtx) {
ObjectContext* objCtx = &globalCtx->objectCtx;
Actor* thisx = &this->actor;
s32 params = thisx->params;
s16 objectId = objectIds[params];
s32 objBankIndex = Object_GetIndex(objCtx, objectId);
s32 pad;
if (objBankIndex < 0) {
osSyncPrintf(VT_FGCOL(RED) "Demo_Geff_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, params);
Actor_Kill(thisx);
return;
}
if (Object_IsLoaded(objCtx, objBankIndex)) {
this->objBankIndex = objBankIndex;
func_80978370(this, globalCtx);
}
}
static void DemoGeff_Update(DemoGeff* this, GlobalContext* globalCtx) {
if (this->action < 0 || this->action >= 2 || actionFuncs[this->action] == NULL) {
osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
return;
}
actionFuncs[this->action](this, globalCtx);
}
static void func_809784D4(DemoGeff* this, GlobalContext* globalCtx) {
}
static void DemoGeff_Draw(DemoGeff* this, GlobalContext* globalCtx) {
s32 drawConfig = this->drawConfig;
s16 pad;
if (drawConfig < 0 || drawConfig >= 2 || drawFuncs[drawConfig] == NULL) {
osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
return;
}
if (drawConfig != 0) {
func_80977F80(this, globalCtx);
}
drawFuncs[drawConfig](this, globalCtx);
}
@@ -4,10 +4,18 @@
#include <ultra64.h>
#include <global.h>
#include "../ovl_Demo_Gt/z_demo_gt.h"
typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x1C];
/* 0x014C */ s32 action;
/* 0x0150 */ s32 drawConfig;
/* 0x0154 */ s32 objBankIndex;
/* 0x0158 */ DemoGt* demoGt;
/* 0x015C */ f32 deltaPosX;
/* 0x0160 */ f32 deltaPosY;
/* 0x0164 */ f32 deltaPosZ;
} DemoGeff; // size = 0x0168
extern const ActorInit Demo_Geff_InitVars;