mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-24 07:10:44 -04:00
b08880f7a7
* Rename Sram_InitDebugSave * Sram_InitDebugSave * err * Sram_IncrementDay * non_matchings * func_80146F5C and protos * func_80146EE8 * func_80145698 * func_80143A54 * Split SaveContext * problems with bss * Fix bss * more * a small bunch * Fix warnings * almost everything * two attempts * at least compiles * import data * bss * format * stuff? * Progress? * More progress * clean up data a little * More progress * disaster * re split data * A bit less of a disaster * Fix renamed stuff * data stuff * fix conflicts * format * CycleSceneFlags * some enums * cleanup * Fix merge issues * format * some changes * format * Lots of progress on z_sram_NES, but no matches yet * SaveContent Documentation * Oops * Oops2 * Document more SaveContext * Oops, don't need that anymore * add small comment * Another comment * dekuPlaygroundPlayerName * Fix merge issues * format * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * remove magic number * format * fix merge issues * bss * format * macro cleanup * review * merge issues * review * cleanup * UNK_TYPE1 * Fix * Remove comment * small change * conflicts * review * fix * fixes * format * Update actorCtx renames part * Match func_80143B0C thanks to Petrie and Anon * minor cleaning pass * format * cleanup * more minor cleanups * Macros for accessing gSaveContext.save.stolenItems * Introduce STOLEN_ITEM_NONE and remove CLEAR_STOLEN_ITEM_ * format * Update include/macros.h Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * @hensldm review * Update include/functions.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update include/functions.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Rename QUEST_SONG_NEW_WAVE * Add scene name comments to D_801C5FC0 * rename horseData.yaw * Update include/functions.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * // = CUR_UPG_VALUE(UPG_WALLET); * run actorfixer and format * fix bss * Fix merge problems and run format * Some improvements to func_801457CC by anon * bss * format * run actorfixer * actorfixer, bss and format * Use original names for the RESPAWN_MODE enum because the current ones are bad * QUEST_SONG_BOSSA_NOVA * some minor fixes on the SaveContext struct according to the debug rom * Merge Inventory.items and Inventory.masks * a * simplify saveBuf accesses * A few func renames * actorfixer * bss * fixes * bss * actorfixer * actorfixer and format * actorfixer * whoops * whops * bss Co-authored-by: engineer124 <engineer124engineer124@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
162 lines
4.4 KiB
C
162 lines
4.4 KiB
C
#include "global.h"
|
|
|
|
typedef struct {
|
|
Actor actor;
|
|
s32 (*pictoFunc)(GlobalContext* globalCtx, Actor* actor);
|
|
} PictoActor;
|
|
|
|
s32 func_8013A240(GlobalContext* globalCtx) {
|
|
PictoActor* pictoActor;
|
|
Actor* actor;
|
|
s32 type = 0;
|
|
s32 seen;
|
|
s32 count = 0;
|
|
|
|
gSaveContext.save.pictoFlags0 = 0;
|
|
gSaveContext.save.pictoFlags1 = 0;
|
|
|
|
if (globalCtx->sceneNum == SCENE_20SICHITAI) {
|
|
func_8013A41C(1);
|
|
}
|
|
|
|
for (; type < 12; type++) {
|
|
for (actor = globalCtx->actorCtx.actorLists[type].first; actor != NULL; actor = actor->next) {
|
|
seen = 0;
|
|
|
|
switch (globalCtx->sceneNum) {
|
|
case SCENE_20SICHITAI:
|
|
if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) {
|
|
seen = 1;
|
|
}
|
|
break;
|
|
default:
|
|
seen = 0;
|
|
}
|
|
|
|
if (actor->id) {
|
|
; // Needed to match
|
|
}
|
|
|
|
switch (actor->id) {
|
|
case ACTOR_EN_KAKASI:
|
|
if ((actor->params & 1) == 1) {
|
|
seen |= 2;
|
|
break; //! @bug break is inside conditional, meaning it falls through if it is false
|
|
}
|
|
case ACTOR_EN_ZOV:
|
|
seen |= 2;
|
|
break;
|
|
case ACTOR_EN_BAL:
|
|
seen |= 2;
|
|
break;
|
|
case ACTOR_EN_DNQ:
|
|
seen |= 2;
|
|
break;
|
|
case ACTOR_EN_GE1:
|
|
case ACTOR_EN_GE3:
|
|
case ACTOR_EN_KAIZOKU:
|
|
case ACTOR_EN_GE2:
|
|
seen |= 2;
|
|
break;
|
|
}
|
|
|
|
if (seen != 0) {
|
|
pictoActor = (PictoActor*)actor;
|
|
if (pictoActor->pictoFunc != NULL) {
|
|
if ((pictoActor->pictoFunc)(globalCtx, actor) == 0) {
|
|
count++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return count;
|
|
}
|
|
|
|
void func_8013A41C(s32 flag) {
|
|
if (flag < 0x20) {
|
|
gSaveContext.save.pictoFlags0 |= (1 << flag);
|
|
} else {
|
|
flag &= 0x1F;
|
|
gSaveContext.save.pictoFlags1 |= (1 << flag);
|
|
}
|
|
}
|
|
|
|
void func_8013A46C(s32 flag) {
|
|
if (flag < 0x20) {
|
|
gSaveContext.save.pictoFlags0 &= ~(1 << flag);
|
|
} else {
|
|
flag &= 0x1F;
|
|
gSaveContext.save.pictoFlags1 &= ~(1 << flag);
|
|
}
|
|
}
|
|
|
|
u32 func_8013A4C4(s32 flag) {
|
|
SaveContext* saveCtx = &gSaveContext;
|
|
|
|
if (flag < 0x20) {
|
|
return saveCtx->save.pictoFlags0 & (1 << flag);
|
|
} else {
|
|
flag &= 0x1F;
|
|
return saveCtx->save.pictoFlags1 & (1 << flag);
|
|
}
|
|
}
|
|
|
|
s16 func_8013A504(s16 val) {
|
|
return (val >= 0) ? val : -val;
|
|
}
|
|
|
|
s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin,
|
|
f32 distanceMax, s16 angleError) {
|
|
Vec3f screenSpace;
|
|
s16 x;
|
|
s16 y;
|
|
f32 distance;
|
|
CollisionPoly* poly;
|
|
Camera* camera = GET_ACTIVE_CAM(globalCtx);
|
|
Actor* actors[2];
|
|
s32 ret = 0;
|
|
s32 bgId;
|
|
|
|
distance = OLib_Vec3fDist(pos, &camera->eye);
|
|
if ((distance < distanceMin) || (distanceMax < distance)) {
|
|
func_8013A41C(0x3F);
|
|
ret = 0x3F;
|
|
}
|
|
|
|
x = func_8013A504(Camera_GetCamDirPitch(camera) + rot->x);
|
|
y = func_8013A504(Camera_GetCamDirYaw(camera) - BINANG_SUB(rot->y, 0x7FFF));
|
|
if ((0 < angleError) && ((angleError < x) || (angleError < y))) {
|
|
func_8013A41C(0x3E);
|
|
ret |= 0x3E;
|
|
}
|
|
|
|
Actor_GetProjectedPos(globalCtx, pos, &screenSpace, &distance);
|
|
x = (s16)(screenSpace.x * distance * 160.0f + 160.0f) - 85;
|
|
y = (s16)(screenSpace.y * distance * -120.0f + 120.0f) - 67;
|
|
if ((x < 0) || (150 < x) || (y < 0) || (105 < y)) {
|
|
func_8013A41C(0x3D);
|
|
ret |= 0x3D;
|
|
}
|
|
|
|
if (BgCheck_ProjectileLineTest(&globalCtx->colCtx, pos, &camera->eye, &screenSpace, &poly, true, true, true, true,
|
|
&bgId)) {
|
|
func_8013A41C(0x3C);
|
|
ret |= 0x3C;
|
|
}
|
|
|
|
actors[0] = actor;
|
|
actors[1] = &GET_PLAYER(globalCtx)->actor;
|
|
if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colChkCtx, pos, &camera->eye, actors, 2)) {
|
|
func_8013A41C(0x3B);
|
|
ret |= 0x3B;
|
|
}
|
|
|
|
if (ret == 0) {
|
|
func_8013A41C(flag);
|
|
}
|
|
|
|
return ret;
|
|
}
|