2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
|
|
|
#include "vt.h"
|
2020-03-29 01:24:39 +00:00
|
|
|
|
|
|
|
QuakeRequest sQuakeRequest[4];
|
|
|
|
s16 D_80126250 = 1;
|
|
|
|
s16 sQuakeRequestCount = 0;
|
2020-04-16 18:08:23 +00:00
|
|
|
|
2020-03-29 01:24:39 +00:00
|
|
|
s16 (*sQuakeCallbacks[])(QuakeRequest*, ShakeInfo*) = {
|
|
|
|
NULL, Quake_Callback1, Quake_Callback2, Quake_Callback3, Quake_Callback4, Quake_Callback5, Quake_Callback6,
|
|
|
|
};
|
|
|
|
|
2020-04-30 14:49:11 +00:00
|
|
|
Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2) {
|
2020-03-29 01:24:39 +00:00
|
|
|
Vec3f vec1;
|
|
|
|
Vec3f vec2;
|
|
|
|
|
2020-08-17 19:42:08 +00:00
|
|
|
OLib_VecSphGeoToVec3f(&vec2, arg2);
|
2020-03-29 01:24:39 +00:00
|
|
|
vec1.x = arg1->x + vec2.x;
|
|
|
|
vec1.y = arg1->y + vec2.y;
|
|
|
|
vec1.z = arg1->z + vec2.z;
|
|
|
|
*dst = vec1;
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x) {
|
2020-04-30 14:49:11 +00:00
|
|
|
Vec3f* unk50 = &req->cam->at;
|
|
|
|
Vec3f* unk5C = &req->cam->eye;
|
2020-03-29 01:24:39 +00:00
|
|
|
|
|
|
|
Vec3f vec;
|
2020-04-30 14:49:11 +00:00
|
|
|
VecSph struc2;
|
|
|
|
VecSph struc1;
|
2020-03-29 01:24:39 +00:00
|
|
|
Vec3f vec2;
|
|
|
|
|
|
|
|
if (req->unk_1C) {
|
|
|
|
vec.x = 0;
|
|
|
|
vec.y = 0;
|
|
|
|
vec.z = 0;
|
2020-08-17 19:42:08 +00:00
|
|
|
OLib_Vec3fDiffToVecSphGeo(&struc1, unk5C, unk50);
|
2020-04-30 14:49:11 +00:00
|
|
|
struc2.r = req->y * y;
|
2020-08-17 19:42:08 +00:00
|
|
|
struc2.pitch = struc1.pitch + req->unk_14.unk_00 + 0x4000;
|
|
|
|
struc2.yaw = struc1.yaw + req->unk_14.unk_02;
|
2020-03-29 01:24:39 +00:00
|
|
|
Quake_AddVec(&vec, &vec, &struc2);
|
2020-04-30 14:49:11 +00:00
|
|
|
struc2.r = req->x * x;
|
2020-08-17 19:42:08 +00:00
|
|
|
struc2.pitch = struc1.pitch + req->unk_14.unk_00;
|
|
|
|
struc2.yaw = struc1.yaw + req->unk_14.unk_02 + 0x4000;
|
2020-03-29 01:24:39 +00:00
|
|
|
Quake_AddVec(&vec, &vec, &struc2);
|
|
|
|
} else {
|
|
|
|
vec.x = 0;
|
|
|
|
vec.y = req->y * y;
|
|
|
|
vec.z = 0;
|
2020-04-30 14:49:11 +00:00
|
|
|
struc2.r = req->x * x;
|
2020-08-17 19:42:08 +00:00
|
|
|
struc2.pitch = req->unk_14.unk_00;
|
|
|
|
struc2.yaw = req->unk_14.unk_02;
|
2020-03-29 01:24:39 +00:00
|
|
|
Quake_AddVec(&vec, &vec, &struc2);
|
|
|
|
}
|
|
|
|
|
|
|
|
vec2 = vec;
|
|
|
|
shake->vec2 = vec2;
|
|
|
|
shake->vec1 = vec2;
|
|
|
|
shake->unk_1A = (f32)0x8000 * y;
|
|
|
|
shake->rotZ = req->rotZ * y;
|
|
|
|
shake->zoom = req->zoom * y;
|
|
|
|
}
|
|
|
|
|
|
|
|
s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
|
2020-07-30 19:50:18 +00:00
|
|
|
s32 pad;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2020-03-29 01:24:39 +00:00
|
|
|
if (req->countdown > 0) {
|
2020-12-26 10:44:53 +00:00
|
|
|
f32 a = Math_SinS(req->speed * req->countdown);
|
|
|
|
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
2020-03-29 01:24:39 +00:00
|
|
|
req->countdown--;
|
|
|
|
}
|
|
|
|
return req->countdown;
|
|
|
|
}
|
|
|
|
|
|
|
|
s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) {
|
|
|
|
if (req->countdown > 0) {
|
2020-12-26 10:44:53 +00:00
|
|
|
f32 a = Math_SinS(req->speed * req->countdown);
|
2020-03-29 01:24:39 +00:00
|
|
|
Quake_UpdateShakeInfo(req, shake, a, a);
|
|
|
|
req->countdown--;
|
|
|
|
}
|
|
|
|
return req->countdown;
|
|
|
|
}
|
|
|
|
|
|
|
|
s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) {
|
2020-07-30 19:50:18 +00:00
|
|
|
s32 pad;
|
2020-03-29 01:24:39 +00:00
|
|
|
f32 a;
|
|
|
|
|
|
|
|
req->countdown--;
|
2020-12-26 10:44:53 +00:00
|
|
|
a = Math_SinS(req->speed * ((req->countdown & 0xF) + 500));
|
|
|
|
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
2020-03-29 01:24:39 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
|
|
|
|
if (req->countdown > 0) {
|
2020-12-26 10:44:53 +00:00
|
|
|
f32 a = Math_SinS(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax);
|
2020-03-29 01:24:39 +00:00
|
|
|
Quake_UpdateShakeInfo(req, shake, a, a);
|
|
|
|
req->countdown--;
|
|
|
|
}
|
|
|
|
return req->countdown;
|
|
|
|
}
|
|
|
|
|
|
|
|
s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
|
|
|
|
if (req->countdown > 0) {
|
2020-12-26 10:44:53 +00:00
|
|
|
f32 a = Rand_ZeroOne();
|
|
|
|
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
2020-03-29 01:24:39 +00:00
|
|
|
req->countdown--;
|
|
|
|
}
|
|
|
|
return req->countdown;
|
|
|
|
}
|
|
|
|
|
|
|
|
s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake) {
|
|
|
|
if (req->countdown > 0) {
|
2020-12-26 10:44:53 +00:00
|
|
|
f32 a = Rand_ZeroOne() * ((f32)req->countdown / (f32)req->countdownMax);
|
|
|
|
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
2020-03-29 01:24:39 +00:00
|
|
|
req->countdown--;
|
|
|
|
}
|
|
|
|
return req->countdown;
|
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
s16 Quake_GetFreeIndex(void) {
|
2020-03-29 01:24:39 +00:00
|
|
|
s32 i;
|
|
|
|
s32 ret;
|
|
|
|
s32 min = 0x10000;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
|
|
|
|
if (sQuakeRequest[i].callbackIdx == 0) {
|
|
|
|
ret = i;
|
|
|
|
min = 0x20000;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sQuakeRequest[i].countdown < min) {
|
|
|
|
min = sQuakeRequest[i].countdown;
|
|
|
|
ret = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (min != 0x20000) {
|
|
|
|
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: too many request %d is changed new one !!\n" VT_RST, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
QuakeRequest* Quake_AddImpl(Camera* cam, u32 callbackIdx) {
|
|
|
|
s16 idx = Quake_GetFreeIndex();
|
2020-04-16 21:36:12 +00:00
|
|
|
QuakeRequest* req = &sQuakeRequest[idx];
|
2020-03-29 01:24:39 +00:00
|
|
|
|
|
|
|
func_80106860(req, 0, sizeof(QuakeRequest)); // memset
|
|
|
|
req->cam = cam;
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
req->camPtrIdx = cam->thisIdx;
|
2020-03-29 01:24:39 +00:00
|
|
|
req->callbackIdx = callbackIdx;
|
|
|
|
req->unk_1C = 1;
|
2020-12-26 10:44:53 +00:00
|
|
|
req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
|
2020-03-29 01:24:39 +00:00
|
|
|
sQuakeRequestCount++;
|
|
|
|
|
|
|
|
return req;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Quake_Remove(QuakeRequest* req) {
|
|
|
|
req->callbackIdx = 0;
|
|
|
|
req->countdown = -1;
|
|
|
|
sQuakeRequestCount--;
|
|
|
|
}
|
|
|
|
|
|
|
|
QuakeRequest* Quake_GetRequest(s16 idx) {
|
2020-04-16 21:36:12 +00:00
|
|
|
QuakeRequest* req = &sQuakeRequest[idx & 3];
|
|
|
|
|
2020-03-29 01:24:39 +00:00
|
|
|
if (req->callbackIdx == 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (idx != req->randIdx) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return req;
|
|
|
|
}
|
|
|
|
|
|
|
|
QuakeRequest* Quake_SetValue(s16 idx, s16 valueType, s16 value) {
|
2021-02-14 00:49:40 +00:00
|
|
|
QuakeRequest* req = Quake_GetRequest(idx);
|
2020-03-29 01:24:39 +00:00
|
|
|
|
|
|
|
if (req == NULL) {
|
|
|
|
return NULL;
|
|
|
|
} else {
|
|
|
|
switch (valueType) {
|
|
|
|
case 1:
|
|
|
|
req->speed = value;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
req->y = value;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
req->x = value;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
req->zoom = value;
|
|
|
|
break;
|
|
|
|
case 0x10:
|
|
|
|
req->rotZ = value;
|
|
|
|
break;
|
|
|
|
case 0x20:
|
|
|
|
req->unk_14.unk_00 = value;
|
|
|
|
break;
|
|
|
|
case 0x40:
|
|
|
|
req->unk_14.unk_02 = value;
|
|
|
|
break;
|
|
|
|
case 0x80:
|
|
|
|
req->unk_14.unk_04 = value;
|
|
|
|
break;
|
|
|
|
case 0x100:
|
|
|
|
req->countdown = value;
|
|
|
|
req->countdownMax = req->countdown;
|
|
|
|
break;
|
|
|
|
case 0x200:
|
|
|
|
req->unk_1C = value;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 Quake_SetSpeed(s16 idx, s16 value) {
|
|
|
|
QuakeRequest* req = Quake_GetRequest(idx);
|
2021-02-14 00:49:40 +00:00
|
|
|
|
|
|
|
if (req != NULL) {
|
2020-03-29 01:24:39 +00:00
|
|
|
req->speed = value;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 Quake_SetCountdown(s16 idx, s16 value) {
|
|
|
|
QuakeRequest* req = Quake_GetRequest(idx);
|
2021-02-14 00:49:40 +00:00
|
|
|
|
|
|
|
if (req != NULL) {
|
2020-03-29 01:24:39 +00:00
|
|
|
req->countdown = value;
|
|
|
|
req->countdownMax = req->countdown;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
s16 Quake_GetCountdown(s16 idx) {
|
|
|
|
QuakeRequest* req = Quake_GetRequest(idx);
|
2021-02-14 00:49:40 +00:00
|
|
|
|
|
|
|
if (req != NULL) {
|
2020-03-29 01:24:39 +00:00
|
|
|
return req->countdown;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 Quake_SetQuakeValues(s16 idx, s16 y, s16 x, s16 zoom, s16 rotZ) {
|
|
|
|
QuakeRequest* req = Quake_GetRequest(idx);
|
2021-02-14 00:49:40 +00:00
|
|
|
|
|
|
|
if (req != NULL) {
|
2020-03-29 01:24:39 +00:00
|
|
|
req->y = y;
|
|
|
|
req->x = x;
|
|
|
|
req->zoom = zoom;
|
|
|
|
req->rotZ = rotZ;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2) {
|
|
|
|
QuakeRequest* req = Quake_GetRequest(idx);
|
2021-02-14 00:49:40 +00:00
|
|
|
|
|
|
|
if (req != NULL) {
|
2020-03-29 01:24:39 +00:00
|
|
|
req->unk_1C = arg1;
|
|
|
|
|
|
|
|
req->unk_14 = arg2;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-02-14 00:49:40 +00:00
|
|
|
void Quake_Init(void) {
|
2020-03-29 01:24:39 +00:00
|
|
|
s16 i;
|
2021-02-14 00:49:40 +00:00
|
|
|
|
2020-03-29 01:24:39 +00:00
|
|
|
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
|
|
|
|
sQuakeRequest[i].callbackIdx = 0;
|
|
|
|
sQuakeRequest[i].countdown = 0;
|
|
|
|
}
|
|
|
|
D_80126250 = 1;
|
|
|
|
sQuakeRequestCount = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
s16 Quake_Add(Camera* cam, u32 callbackIdx) {
|
|
|
|
return Quake_AddImpl(cam, callbackIdx)->randIdx;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 Quake_RemoveFromIdx(s16 idx) {
|
|
|
|
QuakeRequest* req = Quake_GetRequest(idx);
|
2021-02-14 00:49:40 +00:00
|
|
|
|
|
|
|
if (req != NULL) {
|
2020-03-29 01:24:39 +00:00
|
|
|
Quake_Remove(req);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
|
2020-03-29 01:24:39 +00:00
|
|
|
f32 max;
|
|
|
|
f32 max2;
|
|
|
|
QuakeRequest* req;
|
|
|
|
ShakeInfo shake;
|
|
|
|
f32 absSpeedDiv;
|
|
|
|
s16* temp;
|
|
|
|
u32 pad2;
|
|
|
|
s32 idx;
|
|
|
|
s32 ret;
|
|
|
|
u32 eq;
|
|
|
|
Vec3f vec;
|
|
|
|
GlobalContext* globalCtx;
|
|
|
|
|
|
|
|
globalCtx = camera->globalCtx;
|
|
|
|
vec.x = 0.0f;
|
|
|
|
vec.y = 0.0f;
|
|
|
|
vec.z = 0.0f;
|
|
|
|
camData->rotZ = 0;
|
|
|
|
camData->unk_1A = 0;
|
|
|
|
camData->zoom = 0;
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
camData->atOffset.x = 0.0f;
|
|
|
|
camData->atOffset.y = 0.0f;
|
|
|
|
camData->atOffset.z = 0.0f;
|
|
|
|
camData->eyeOffset.x = 0.0f;
|
|
|
|
camData->eyeOffset.y = 0.0f;
|
|
|
|
camData->eyeOffset.z = 0.0f;
|
2020-03-29 01:24:39 +00:00
|
|
|
camData->unk_20 = 0.0f;
|
|
|
|
|
|
|
|
if (sQuakeRequestCount == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) {
|
|
|
|
req = &sQuakeRequest[idx];
|
|
|
|
if (req->callbackIdx != 0) {
|
2020-04-16 21:36:12 +00:00
|
|
|
if (globalCtx->cameraPtrs[req->camPtrIdx] == 0) {
|
2020-03-29 01:24:39 +00:00
|
|
|
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST,
|
|
|
|
req->camPtrIdx);
|
|
|
|
Quake_Remove(req);
|
|
|
|
} else {
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
temp = &camera->thisIdx;
|
|
|
|
eq = req->cam->thisIdx != *temp;
|
2020-03-29 01:24:39 +00:00
|
|
|
absSpeedDiv = ABS(req->speed) / (f32)0x8000;
|
|
|
|
if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) {
|
|
|
|
Quake_Remove(req);
|
|
|
|
} else if (eq == 0) {
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
if (fabsf(camData->atOffset.x) < fabsf(shake.vec1.x)) {
|
|
|
|
camData->atOffset.x = shake.vec1.x;
|
2020-03-29 01:24:39 +00:00
|
|
|
}
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
if (fabsf(camData->atOffset.y) < fabsf(shake.vec1.y)) {
|
|
|
|
camData->atOffset.y = shake.vec1.y;
|
2020-03-29 01:24:39 +00:00
|
|
|
}
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
if (fabsf(camData->atOffset.z) < fabsf(shake.vec1.z)) {
|
|
|
|
camData->atOffset.z = shake.vec1.z;
|
2020-03-29 01:24:39 +00:00
|
|
|
}
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
if (fabsf(camData->eyeOffset.x) < fabsf(shake.vec2.x)) {
|
|
|
|
camData->eyeOffset.x = shake.vec2.x;
|
2020-03-29 01:24:39 +00:00
|
|
|
}
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
if (fabsf(camData->eyeOffset.y) < fabsf(shake.vec2.y)) {
|
|
|
|
camData->eyeOffset.y = shake.vec2.y;
|
2020-03-29 01:24:39 +00:00
|
|
|
}
|
decompile z_camera (#398)
* cleanup
* name camera action functions
* decompile a few small functions, name a few Camera struct members
* decompile camera data, decompile a few camera functions
* Split ASM for code_800BB0A0
* removing code_800BB0A0.s
* PR Requests, Camera WIP
* remove #define NON_MATCHING from db_camera
* rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c
* camera wip
* rename some struct memebers, some decomp wip
* pr updates
* camera wip
* name some fields in Camera Struct, being making sense of Camera_Update
* Camera WIP
* wip
* wip
* add z64camera.h header, begin creating CameraSetting macros
* wip
* wip
* wip
* wip
* migrate camera bss to c
* match a couple functions in db_camera
* match some small db_camera functions
* wip
* migrate db_camera rodata, match a few functions
* remote db_camera.rodata.s
* match some of db_camera
* identify types of some unknown data pieces
* some small wip
* Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs
* add naming for a few more Camera struct members
* wip
* match func_80043F94
* Match Camera_Jump1
* document some of Camera_Jump1
* wip
* match Camera_Jump3
* Match Camera_Update, FeelsAmazing
* wip
* wip
* match Camera_SetParam
* minor cleanup
* wip
* wip
* match Camera_KeepOn0
* some documentation, modify some matching functions to match style of others.
* match Camera_Demo1
* match camera_demo9
* document Camera_Demo1 and Camera_Demo9
* wip
* Match camera_battle4
* match camera_unique2
* Match Camera_Unique3
* match camera_special6
* match Camera_Special5
* wip
* document camera_special6
* naming updates
* match camera_Unique1
* match Camera_Unique0
* wip
* Match Camera_CalcUpFromPitchYawRoll
* match func_80045508
* document Camera_Battle4
* document several camera functions, move camera data to separate file
* rename phi/theta to pitch/yaw
* wip
* uniq9 wip
* Camera_Unqiue9 OK
* document Camera_Unique9
* name unk_160 in camera struct
* wip
* wip
* minor updates
* fix conflicts
* wip
* wip
* Olib updates
* wip
* wip
* rename most Math3D functions, few matches, documentation
* wip
* document most of math3d
* wip
* wip
* wip
* pr updates
* Match Camera_Fixed4
* match func_80058E8C
* pr updates
* add missing comment block finalizer
* Merge math3dupdates
* match Camera_ChangeSetting
* Match Camera_ChangeMode
* match func_80058148
* Match Camera_Special9
* decompile the rest of camera data
* match Camera_Demo5
* name a few camera functions in z_play
* match func_80046CB4, some work on other fucntions
* wip
* impove some non matchings
* fix function rename
* match func_800588B4
* match Camera_Subj4
* wip
* Camera_Demo3 matching, Camera_Battle1 big progress
* Camera_Normal2 OK
* wip
* match Camera_Parallel1
* normalize some things across functions
* match Camera_Normal1
* Match Camera_Normal3
* some cleanup
* more cleanup
* more cleanup , match Camera_CalcDefaultPitch
* data formatting
* Match Camera_Jump2
* document Camera_Jump2
* Match Camera_KeepOn3
* document some of Camera_KeepOn3
* improve some non_matchings
* match func_80045C74 and func_800460A8
* code cleanup, documentation
* match Camera_KeepOn1
* Match Camera_Subj3
* Match Camera_Battle1
* remove non_matching from func_80044adc and func_80046e20
* name several members of Battle1
* more documentation on Battle1
* cleanup
* renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector
* reorganize update structs, remove final references to params, remove CameraParams union
* implement camera enums into player
* Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player
* remove non-global camera variables from variables.h
* clean up some variable declarations
* finish pr comment updates
* fix some warnings
* data formatting
* finish commenting on data
* delete unused asm
* remove asm
Co-authored-by: fig <fig02srl@gmail.com>
2020-12-06 22:39:47 +00:00
|
|
|
if (fabsf(camData->eyeOffset.z) < fabsf(shake.vec2.z)) {
|
|
|
|
camData->eyeOffset.z = shake.vec2.z;
|
2020-03-29 01:24:39 +00:00
|
|
|
}
|
|
|
|
if (camData->rotZ < shake.rotZ) {
|
|
|
|
camData->rotZ = shake.rotZ;
|
|
|
|
camData->unk_1A = shake.unk_1A;
|
|
|
|
}
|
|
|
|
if (camData->zoom < shake.zoom) {
|
|
|
|
camData->zoom = shake.zoom;
|
|
|
|
}
|
|
|
|
|
2020-06-04 05:59:17 +00:00
|
|
|
max = OLib_Vec3fDist(&shake.vec1, &vec) * absSpeedDiv;
|
|
|
|
max2 = OLib_Vec3fDist(&shake.vec2, &vec) * absSpeedDiv;
|
2020-03-29 01:24:39 +00:00
|
|
|
if (max < max2) {
|
|
|
|
max = max2;
|
|
|
|
}
|
|
|
|
max2 = (camData->rotZ * 0.005f) * absSpeedDiv;
|
|
|
|
if (max < max2) {
|
|
|
|
max = max2;
|
|
|
|
}
|
|
|
|
max2 = (camData->zoom * 0.005f) * absSpeedDiv;
|
|
|
|
if (max < max2) {
|
|
|
|
max = max2;
|
|
|
|
}
|
|
|
|
if (camData->unk_20 < max) {
|
|
|
|
camData->unk_20 = max;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|