Even more general cleanup (#1640)

* floats

* obj_lightblock externs

* Couple more floats

* slime floats

* undefined_syms

* Move some tools to the tools folder

* format

* Update src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>

---------

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
This commit is contained in:
Derek Hensley 2024-06-01 08:01:19 -07:00 committed by GitHub
parent 659e2b5088
commit 312b65d5e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 26 additions and 61 deletions

View File

@ -110,7 +110,7 @@ See the [Style Guide](STYLE.md) for more details on documentation style.
Before opening a PR, walk through the following steps to ensure that your code conforms to the style guide and conventions.
- `make` successfully builds a matching ROM.
- `./format.py` was run to apply standard formatting.
- `./tools/format.py` was run to apply standard formatting.
- No new compiler warnings were introduced during the build process.
- Can be verified locally by running `tools/warnings_count/check_new_warnings.sh`
- New variables & functions should follow standard naming conventions.

View File

@ -6,8 +6,8 @@
- [`diff.py`](#diffpy)
- [`tools/m2ctx.py`](#toolsm2ctxpy)
- [`tools/overlayhelpers/actor_symbols.py`](#toolsoverlayhelpersactor_symbolspy)
- [`first_diff.py`](#first_diffpy)
- [`sym_info.py`](#sym_infopy)
- [`tools/first_diff.py`](#first_diffpy)
- [`tools/sym_info.py`](#sym_infopy)
- [`extract_assets.py`](#extract_assetspy)
- [`tools/assist.py`](#toolsassistpy)
- [`tools/get_actor_sizes.py`](#toolsget_actor_sizespy)
@ -22,8 +22,8 @@
- [`tools/graphovl.py`](#toolsgraphovlpy)
- [`tools/warnings_count/check_new_warnings.sh`](#toolswarnings_countcheck_new_warningssh)
- [`tools/warnings_count/update_current_warnings.sh`](#toolswarnings_countupdate_current_warningssh)
- [`fixle.sh`](#fixlesh)
- [`format.py`](#formatpy)
- [`tools/fixle.sh`](#fixlesh)
- [`tools/format.py`](#formatpy)
- [External tools](#external-tools)
- [mips_to_c](#mips_to_c)
- [Permuter](#permuter)
@ -108,16 +108,16 @@ Pass it the path to a C file to generate the context for that C file, to help [m
Takes a VRAM or VROM address to get overlay file and offset for an Actor.
### `first_diff.py`
### `tools/first_diff.py`
Gives you the addresses of first difference in the ROM, the difference, and a count of how many bytes differ, or if the whole ROM is shifted.
### `sym_info.py`
### `tools/sym_info.py`
Can be given a symbol (function or variable name, for example), and will find its ROM, VRAM, and file using the map file. E.g.
```bash
$ ./sym_info.py ObjTree_Init
$ ./tools/sym_info.py ObjTree_Init
Symbol ObjTree_Init (RAM: 0x80B9A0B0, ROM: 0xFFF210, build/n64-us/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.o)
```
@ -208,11 +208,11 @@ Run `check_new_warnings.sh -h` for more information.
If you have to add new warnings, **and have permission from the leads**, run this to update the file used for warnings comparison.
### `fixle.sh`
### `tools/fixle.sh`
Fixes line endings in the repo to Linux style (LF), which is required for the build process to work. (You may be better off creating a new clone directly in Linux/WSL, though)
### `format.py`
### `tools/format.py`
Formats all C files in the repo using `clang-format-14`, `clang-tidy`, and `clang-apply-replacements` (when multiprocessing). This will touch all files in the repo, so the next `make` will take longer.

View File

@ -142,46 +142,25 @@ D_01000000 = 0x01000000;
// segment 0x02
D_02000400 = 0x02000400;
D_02000E60 = 0x02000E60;
D_02002460 = 0x02002460;
D_020029A0 = 0x020029A0;
D_02002AA0 = 0x02002AA0;
D_02003F20 = 0x02003F20;
D_0200B998 = 0x0200B998;
// segment 0x03
// segment 0x04
D_0401ED00 = 0x0401ED00;
D_04023210 = 0x04023210;
D_04023348 = 0x04023348;
D_040233B8 = 0x040233B8;
D_04023428 = 0x04023428;
D_04029CB0 = 0x04029CB0;
D_04029CF0 = 0x04029CF0;
D_0402E510 = 0x0402E510;
D_04030100 = 0x04030100;
D_0403F230 = 0x0403F230;
D_04050D10 = 0x04050D10;
D_04051180 = 0x04051180;
D_04051238 = 0x04051238;
D_04054940 = 0x04054940;
D_040549A8 = 0x040549A8;
D_0406AB30 = 0x0406AB30;
D_040706E0 = 0x040706E0;
D_04076BC0 = 0x04076BC0;
D_0407AB70 = 0x0407AB70;
D_0407D590 = 0x0407D590;
D_0407E8C0 = 0x0407E8C0;
D_0407F218 = 0x0407F218;
// segment 0x05
D_050085F0 = 0x050085F0;
D_050089D0 = 0x050089D0;
// segment 0x06
// ovl_Bg_Dblue_Elevator
@ -356,16 +335,6 @@ D_06003EE4 = 0x06003EE4;
D_06004204 = 0x06004204;
D_0600466C = 0x0600466C;
// ovl_En_Wdhand
D_060000F4 = 0x060000F4;
D_06000364 = 0x06000364;
D_06000534 = 0x06000534;
D_06000854 = 0x06000854;
D_060014C0 = 0x060014C0;
D_060015B0 = 0x060015B0;
D_06001E20 = 0x06001E20;
// ovl_En_Zl4
D_06013328 = 0x06013328;
@ -380,8 +349,6 @@ D_08000000 = 0x08000000;
// segment 0x0A
D_0A000D40 = 0x0A000D40;
// segment 0x0B
// segment 0x0C

View File

@ -64,7 +64,7 @@ s32 func_80B83C80(Vec3f* arg0, Vec3f* arg1) {
f32 temp_f0 = Math3D_LengthSquared(arg0);
f32 temp_f2;
if (temp_f0 < 0.0000010000001f) {
if (temp_f0 < SQ(0.001f)) {
return false;
}

View File

@ -2130,7 +2130,7 @@ void Boss03_Update(Actor* thisx, PlayState* play2) {
for (j = 0, i = 0; i < 20; j++) {
Matrix_RotateYF(yRot, MTXMODE_NEW);
Matrix_MultVecZ(Rand_ZeroFloat(60.000004f) + 312.0f, &dropletPos);
Matrix_MultVecZ(Rand_ZeroFloat(60000.0f * 0.001f) + 312.0f, &dropletPos);
dropletPos.x += this->unk_284 + Rand_CenteredFloat(40.0f);
dropletPos.y = PLATFORM_HEIGHT;
dropletPos.z += this->unk_28C + Rand_CenteredFloat(40.0f);

View File

@ -2470,10 +2470,11 @@ void BossHakugin_DeathCutsceneSwerveIntoWall(BossHakugin* this, PlayState* play)
BossHakugin_RunUpdateCommon(this, play);
if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetRotY, 0x300) &&
((this->distToRightWall <= 189.00002f) || (this->distToLeftWall <= 189.00002f))) {
((this->distToRightWall <= (189000.0f * 0.001f)) || (this->distToLeftWall <= (189000.0f * 0.001f)))) {
BossHakugin_SetupDeathCutsceneCrushedByRocks(this);
} else if (((this->direction == GOHT_DIRECTION_CLOCKWISE) && (this->distToRightWall <= 189.00002f)) ||
((this->direction == GOHT_DIRECTION_COUNTERCLOCKWISE) && (this->distToLeftWall <= 189.00002f))) {
} else if (((this->direction == GOHT_DIRECTION_CLOCKWISE) && (this->distToRightWall <= (189000.0f * 0.001f))) ||
((this->direction == GOHT_DIRECTION_COUNTERCLOCKWISE) &&
(this->distToLeftWall <= (189000.0f * 0.001f)))) {
absTargetRotY = ABS_ALT(this->targetRotY);
if (absTargetRotY < 0x2000) {
this->actor.world.pos.z = -1389.0f;

View File

@ -2405,7 +2405,7 @@ void EnBigslime_GekkoDespawn(EnBigslime* this, PlayState* play) {
Camera* subCam;
this->despawnTimer--;
this->gekkoScale = this->despawnTimer * 0.00035000002f;
this->gekkoScale = this->despawnTimer * (0.35f * 0.001f);
if (this->despawnTimer == 0) {
EnBigslime_SetupFrogSpawn(this, play);
} else {

View File

@ -238,7 +238,7 @@ void func_808D0A48(EnFloormas* this, PlayState* play) {
this->collider.base.colType = COLTYPE_HIT0;
this->drawDmgEffAlpha = 0.0f;
Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ENFLOORMAS_BODYPART_MAX, 2,
this->actor.scale.x * 30.000002f, this->actor.scale.x * 20.0f);
this->actor.scale.x * (30000.0f * 0.001f), this->actor.scale.x * 20.0f);
if (this->actor.scale.x > 0.009f) {
this->actor.flags |= ACTOR_FLAG_400;
} else {

View File

@ -4121,7 +4121,7 @@ void EnHorse_TiltBody(EnHorse* this, PlayState* play) {
speed = this->actor.speed / this->boostSpeed;
turnVel = this->actor.shape.rot.y - this->lastYaw;
targetRoll = -TRUNCF_BINANG((2730.0f * speed) * (turnVel / 960.00006f));
targetRoll = -TRUNCF_BINANG((2730.0f * speed) * (turnVel / (9.6f * 100.0f)));
rollDiff = targetRoll - this->actor.world.rot.z;
if (fabsf(targetRoll) < 100.0f) {

View File

@ -939,7 +939,7 @@ void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, PlayState* play) {
void EnPametfrog_DefeatSnapper(EnPametfrog* this, PlayState* play) {
this->timer--;
Actor_SetScale(&this->actor, this->timer * 0.00035000002f);
Actor_SetScale(&this->actor, this->timer * (0.35f * 0.001f));
this->actor.colorFilterTimer = 16;
EnPametfrog_ShakeCamera(this, play, (this->timer * 3.75f) + 75.0f, (this->timer * 0.5f) + 10.0f);
if (this->timer == 0) {

View File

@ -598,7 +598,7 @@ void func_80B2DDF8(EnPoh* this, s32 arg1) {
if (arg1 < 0) {
temp_f2 = this->unk_197 * (1.0f / 255.0f);
this->actor.scale.x = this->actor.scale.z = (0.0056000003f * temp_f2) + 0.0014000001f;
this->actor.scale.x = this->actor.scale.z = ((5.6f * 0.001f) * temp_f2) + (1.4f * 0.001f);
this->actor.scale.y = (0.007f - (0.007f * temp_f2)) + 0.007f;
} else {
temp_f2 = 1.0f;

View File

@ -983,20 +983,20 @@ void EnSlime_Revive(EnSlime* this, PlayState* play) {
EnSlime_SetupMoveInDirection(this);
} else {
if (this->timer < 12) {
rescaleFactor1 = this->timer * 0.0008333333f; // This is about 1/1200, but (1.0f/1200.0f) does not match
rescaleFactor1 = this->timer * (0.01f / 12.0f); // This is about 1/1200, but (1.0f/1200.0f) does not match
this->reviveScale.x = rescaleFactor1;
this->reviveScale.z = rescaleFactor1;
this->reviveScale.y = 2.0f * rescaleFactor1;
this->reviveRotY = this->timer * (0x4000 / 10.0f);
} else if (this->timer < 20) {
rescaleFactor1 = (this->timer - 12) * (1.0f / 1600.0f);
rescaleFactor1 = (this->timer - 12) * (0.01f / 16.0f);
rescaleFactor2 = 0.01f + rescaleFactor1;
this->reviveScale.x = rescaleFactor2;
this->reviveScale.z = rescaleFactor2;
this->reviveScale.y = 2.0f * (0.01f - rescaleFactor1);
this->reviveRotY = this->timer * (0x4000 / 10.0f);
} else if (this->timer < 24) {
rescaleFactor1 = (this->timer - 20) * 0.0033333332f; // This is about 1/300
rescaleFactor1 = (this->timer - 20) * (0.01f / 3.0f); // This is about 1/300
rescaleFactor2 = 0.015f - rescaleFactor1;
this->reviveScale.x = rescaleFactor2;
this->reviveScale.z = rescaleFactor2;

View File

@ -74,9 +74,6 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 500, ICHAIN_STOP),
};
extern Gfx D_801AEF88[];
extern Gfx D_801AEFA0[];
void ObjLightblock_SpawnEffect(ObjLightblock* this, PlayState* play) {
LightblockTypeVars* typeVars = &sLightblockTypeVars[LIGHTBLOCK_TYPE(&this->dyna.actor)];

View File

@ -1,7 +1,7 @@
#!/bin/bash
STATUSOLD=`git status --porcelain`
./format.py -j
./tools/format.py -j
if [ $? -ne 0 ]
then
echo "Formatter failed. Exiting."
@ -12,7 +12,7 @@ STATUSNEW=`git status --porcelain`
if [ "${STATUSOLD}" != "${STATUSNEW}" ];
then
echo ""
echo "Misformatted files found. Run ./format.py and verify codegen is not impacted."
echo "Misformatted files found. Run ./tools/format.py and verify codegen is not impacted."
echo ""
diff --unified=0 --label "Old git status" <(echo "${STATUSOLD}") --label "New git status" <(echo "${STATUSNEW}")
echo ""