Skip to content

Commit

Permalink
Naming1 (#1113)
Browse files Browse the repository at this point in the history
* typo

* rename 800636C0 to gameinfo_init

* fix incorrect casing in cup button

* some constants

* add item00_none enum value

* rename 80009460 to gdmaverbose

* fix typos

* Revert "some constants"

This reverts commit 27a0720.

* rename gdmaverbose to gdmamgrverbose

* Revert "rename 800636C0 to gameinfo_init"

This reverts commit c74e255.

* Revert "fix incorrect casing in cup button"

This reverts commit ac313b3.

* a couple of typos

* minor changes based on clang-format
  • Loading branch information
playerskel authored Mar 10, 2022
1 parent c55a853 commit a160fb9
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 270 deletions.
2 changes: 1 addition & 1 deletion include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern u8 osAppNmiBuffer[0x40];
extern u8 D_80009320[];
extern u8 D_800093F0[];
extern s8 D_80009430;
extern u32 D_80009460;
extern u32 gDmaMgrVerbose;
extern u32 gDmaMgrDmaBuffSize;
extern vu8 gViConfigUseDefault;
extern u8 gViConfigAdditionalScanLines;
Expand Down
3 changes: 2 additions & 1 deletion include/z64actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ typedef enum {
/* 0x16 */ ITEM00_SHIELD_HYLIAN,
/* 0x17 */ ITEM00_TUNIC_ZORA,
/* 0x18 */ ITEM00_TUNIC_GORON,
/* 0x19 */ ITEM00_BOMBS_SPECIAL
/* 0x19 */ ITEM00_BOMBS_SPECIAL,
/* 0xFF */ ITEM00_NONE = 0xFF
} Item00Type;

struct EnItem00;
Expand Down
2 changes: 1 addition & 1 deletion include/z64save.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ typedef struct {
/* 0x003F */ u8 ocarinaGameRoundNum;
/* 0x0040 */ ItemEquips childEquips;
/* 0x004A */ ItemEquips adultEquips;
/* 0x0054 */ u32 unk_54; // this may be incorrect, currently used for alignement
/* 0x0054 */ u32 unk_54; // this may be incorrect, currently used for alignment
/* 0x0058 */ char unk_58[0x0E];
/* 0x0066 */ s16 savedSceneNum;
/* 0x0068 */ ItemEquips equips;
Expand Down
14 changes: 7 additions & 7 deletions src/boot/z_std_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ STACK(sDmaMgrStack, 0x500);
const char* sDmaMgrCurFileName;
s32 sDmaMgrCurFileLine;

u32 D_80009460 = 0;
u32 gDmaMgrVerbose = 0;
u32 gDmaMgrDmaBuffSize = 0x2000;
u32 sDmaMgrIsRomCompressed = false;

Expand Down Expand Up @@ -68,7 +68,7 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
ioMsg.dramAddr = (void*)ram;
ioMsg.size = buffSize;

if (D_80009460 == 10) {
if (gDmaMgrVerbose == 10) {
osSyncPrintf("%10lld ノーマルDMA %08x %08x %08x (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), ioMsg.dramAddr,
ioMsg.devAddr, ioMsg.size, gPiMgrCmdQ.validCount);
}
Expand All @@ -78,12 +78,12 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
goto end;
}

if (D_80009460 == 10) {
if (gDmaMgrVerbose == 10) {
osSyncPrintf("%10lld ノーマルDMA START (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount);
}

osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
if (D_80009460 == 10) {
if (gDmaMgrVerbose == 10) {
osSyncPrintf("%10lld ノーマルDMA END (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount);
}

Expand All @@ -100,7 +100,7 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
ioMsg.dramAddr = (void*)ram;
ioMsg.size = size;

if (D_80009460 == 10) {
if (gDmaMgrVerbose == 10) {
osSyncPrintf("%10lld ノーマルDMA %08x %08x %08x (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), ioMsg.dramAddr,
ioMsg.devAddr, ioMsg.size, gPiMgrCmdQ.validCount);
}
Expand All @@ -111,7 +111,7 @@ s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
}

osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
if (D_80009460 == 10) {
if (gDmaMgrVerbose == 10) {
osSyncPrintf("%10lld ノーマルDMA END (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount);
}

Expand All @@ -129,7 +129,7 @@ s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
ASSERT(direction == OS_READ, "direction == OS_READ", "../z_std_dma.c", 531);
ASSERT(mb != NULL, "mb != NULL", "../z_std_dma.c", 532);

if (D_80009460 == 10) {
if (gDmaMgrVerbose == 10) {
osSyncPrintf("%10lld サウンドDMA %08x %08x %08x (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), mb->dramAddr,
mb->devAddr, mb->size, gPiMgrCmdQ.validCount);
}
Expand Down
2 changes: 1 addition & 1 deletion src/code/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void func_800C4344(GameState* gameState) {
func_8006390C(&gameState->input[1]);
}

D_80009460 = HREG(60);
gDmaMgrVerbose = HREG(60);
gDmaMgrDmaBuffSize = SREG(21) != 0 ? ALIGN16(SREG(21)) : 0x2000;
gSystemArenaLogSeverity = HREG(61);
gZeldaArenaLogSeverity = HREG(62);
Expand Down
22 changes: 10 additions & 12 deletions src/code/sys_math3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ f32 Math3D_Cos(Vec3f* a, Vec3f* b) {
}

/**
* Calculates the cosine between bectors `a` and `b` and places the result in `ret`
* Calculates the cosine between vectors `a` and `b` and places the result in `ret`
* returns true if the cosine cannot be calculated because the product of the magnitudes is zero
*/
s32 Math3D_CosOut(Vec3f* a, Vec3f* b, f32* dst) {
Expand Down Expand Up @@ -876,9 +876,9 @@ void Math3D_RotateXZPlane(Vec3f* pointOnPlane, s16 angle, f32* a, f32* c, f32* d
}

/*
* Defines a plane from verticies `va`, `vb`, and `vc`. Normal components are output to
* Defines a plane from vertices `va`, `vb`, and `vc`. Normal components are output to
* `nx`, `ny`, and `nz`. Distance from the origin is output to `originDist`
* Satisifes the plane equation NxVx + NyVy + NzVz + D = 0
* Satisfies the plane equation NxVx + NyVy + NzVz + D = 0
*/
void Math3D_DefPlane(Vec3f* va, Vec3f* vb, Vec3f* vc, f32* nx, f32* ny, f32* nz, f32* originDist) {
static Vec3f normal;
Expand Down Expand Up @@ -1340,7 +1340,7 @@ s32 Math3D_LineSegFindPlaneIntersect(f32 pointADist, f32 pointBDist, Vec3f* poin
}

/**
* Determines if the line segement from `linePointA` to `linePointB` crosses the plane
* Determines if the line segment from `linePointA` to `linePointB` crosses the plane
* from `nx` + `ny` + `nz` + `originDist` = 0. If fromFront is set, then detection will only
* be true if point A crosses from the front of the plane
*/
Expand All @@ -1366,7 +1366,7 @@ s32 Math3D_LineSegVsPlane(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* linePoi
}

/*
* Determines if the line formed by `linePiontA` and `linePointB` intersect with Triangle formed from
* Determines if the line formed by `linePointA` and `linePointB` intersect with Triangle formed from
* vertices `v0`, `v1`, and `v2` with normal vector `nx`, `ny`, and `nz` with plane distance from origin
* `originDist` Outputs the intersection point at to `intersect`
* Returns 1 if the line intersects with the triangle, 0 otherwise
Expand Down Expand Up @@ -1404,17 +1404,16 @@ void Math3D_TriNorm(TriNorm* tri, Vec3f* va, Vec3f* vb, Vec3f* vc) {
* Determines if point `point` lies within `sphere`
*/
s32 Math3D_PointInSph(Sphere16* sphere, Vec3f* point) {

if (Math3D_DistXYZ16toF(&sphere->center, point) < sphere->radius) {
return true;
}
return false;
}

/**
* Determines the distance from point (`x0`,`y0`) to the line fromed from (`x1`,`y1`) and (`x2`,`y2`)
* Determines the distance from point (`x0`,`y0`) to the line formed from (`x1`,`y1`) and (`x2`,`y2`)
* Distance squared is output to `lineLenSq`, returns true if the point perpendicular from (`x0`,`y0`)
* is contained within the segement between (`x1`,`y1`) and (`x2`,`y2`)
* is contained within the segment between (`x1`,`y1`) and (`x2`,`y2`)
*/
s32 Math3D_PointDistToLine2D(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32* lineLenSq) {
static Vec3f perpendicularPoint;
Expand Down Expand Up @@ -1832,7 +1831,7 @@ s32 Math3D_CylTriVsIntersect(Cylinder16* cyl, TriNorm* tri, Vec3f* intersect) {

if (((tri->vtx[0].y < cylBottom) && (tri->vtx[1].y < cylBottom) && (tri->vtx[2].y < cylBottom)) ||
((cylTop < tri->vtx[0].y) && (cylTop < tri->vtx[1].y) && (cylTop < tri->vtx[2].y))) {
// If all of the verticies are below or all of the verticies are above the cylinder.
// If all of the vertices are below or all of the vertices are above the cylinder.
return false;
}

Expand Down Expand Up @@ -1912,7 +1911,7 @@ s32 Math3D_CylVsTri(Cylinder16* cyl, TriNorm* tri) {
}

/*
* Deteremines if two spheres are touching.
* Determines if two spheres are touching.
*/
s32 Math3D_SphVsSph(Sphere16* sphereA, Sphere16* sphereB) {
f32 overlapSize;
Expand Down Expand Up @@ -2021,7 +2020,7 @@ s32 Math3D_CylOutsideCyl(Cylinder16* ca, Cylinder16* cb, f32* deadSpace) {
/*
* returns 1 if cylinder `ca` is outside cylinder `cb`.
* Sets `xzDist` to the xz distance between the centers of the cylinders.
* Sets `deadSpace` to the mininum space between the cylinders not occupied by the other.
* Sets `deadSpace` to the minimum space between the cylinders not occupied by the other.
*/
s32 Math3D_CylOutsideCylDist(Cylinder16* ca, Cylinder16* cb, f32* deadSpace, f32* xzDist) {
static Cylinderf caf;
Expand Down Expand Up @@ -2059,7 +2058,6 @@ s32 Math3D_CylOutsideCylDist(Cylinder16* ca, Cylinder16* cb, f32* deadSpace, f32
* intersection is output to `intersect.
* Returns 1 is the triangles intersect, 0 otherwise
*/

s32 Math3D_TriVsTriIntersect(TriNorm* ta, TriNorm* tb, Vec3f* intersect) {
f32 dist0;
f32 dist1;
Expand Down
Loading

0 comments on commit a160fb9

Please sign in to comment.