-
Notifications
You must be signed in to change notification settings - Fork 38
zNPCSpawner WIP #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
zNPCSpawner WIP #407
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a096aef
Add template function xUtil_select to xutil.h.
daft7 ad9d0b3
Filled in zNPCCommon struct with information from m2c decompiler.
daft7 4a06066
Edited pendlist and actvlist types to pointers.
daft7 4c83651
Modified existing functions to smooth additions.
daft7 2e09055
Added partial matches for FillPending, ReFillPending, NextPendingNPC,…
daft7 8396a3d
zNPCCommon definition removed, now included from zNPCTypeCommon. Move…
daft7 c1660b7
zNPCTypeDuplotron now pulls zNPCSpawner definition directly from zNPC…
daft7 1e4b564
Quick patches to data types after using more detailed definition of z…
daft7 7197929
Revert pendlist and actvllist to not being pointers.
daft7 3c2b0c5
Implemented suggested fixes to NextPendingNPC.
daft7 8b9b270
Used Clang to format.
daft7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -177,3 +177,95 @@ U8 zMovePoint::IsOn() | |
| { | ||
| return this->on; | ||
| } | ||
|
|
||
| st_XORDEREDARRAY* zNPCSpawner::FillPending() | ||
| { | ||
| ClearPending(); | ||
| ReFillPending(); | ||
| return &this->actvlist; | ||
| } | ||
|
|
||
| st_XORDEREDARRAY* zNPCSpawner::ReFillPending() | ||
| { | ||
| s32 var_r28; | ||
| zNPCCommon* temp_r29; | ||
| zNPCSpawner* var_r30; | ||
|
|
||
| var_r28 = 0; | ||
| var_r30 = this; | ||
| do | ||
| { | ||
| temp_r29 = var_r30->npc_owner; | ||
| if (((zNPCCommon*)var_r30->npc_owner != NULL) && ((s32)temp_r29->flg_vuln == 1)) | ||
| { | ||
| XOrdAppend(&this->pendlist, (void*)temp_r29); | ||
| temp_r29->flg_vuln = 2; | ||
| } | ||
| var_r28 += 1; | ||
| var_r30 += 0xC; | ||
| } while (var_r28 < 0x10); | ||
| return &this->actvlist; | ||
| } | ||
|
|
||
| // void zNPCSpawner::ClearActive() | ||
| // { | ||
| // s32 var_r6; | ||
| // s32 var_r7; | ||
| // void *temp_r5; | ||
|
|
||
| // var_r7 = 0; | ||
| // var_r6 = 0; | ||
| // loop_4: | ||
| // if (var_r7 < (s32) this->cnt_cleanup) { | ||
| // temp_r5 = *(this->pendlist->list + var_r6); | ||
| // if (temp_r5 != NULL) { | ||
| // (u32) temp_r5[1] = 1; | ||
| // } | ||
| // var_r6 += 4; | ||
| // var_r7 += 1; | ||
| // goto loop_4; | ||
| // } | ||
| // XOrdReset__FP16st_XORDEREDARRAY(&this->unk1B0); | ||
| // } | ||
|
|
||
| SMNPCStatus* zNPCSpawner::NextPendingNPC(S32 arg0) | ||
| { | ||
| S32 temp_r4; | ||
| const F32* temp_ptr = NULL; | ||
|
|
||
| temp_r4 = this->pendlist.cnt; | ||
| if (temp_r4 < 1) | ||
| { | ||
| return NULL; | ||
| } | ||
| return xUtil_select<SMNPCStatus>((SMNPCStatus**)this->pendlist.list, temp_r4, temp_ptr); | ||
| } | ||
|
|
||
| /* zNPCSpawner::StatForNPC (zNPCCommon *) */ | ||
| SMNPCStatus* zNPCSpawner::StatForNPC(zNPCCommon* npc) | ||
| { | ||
| s32 var_ctr; | ||
| SMNPCStatus* var_r6; | ||
| zNPCCommon* temp_r0; | ||
| zNPCCommon* temp_r0_2; | ||
| zNPCCommon* temp_r0_3; | ||
| zNPCCommon* temp_r0_4; | ||
| zNPCCommon* temp_r0_5; | ||
| zNPCCommon* temp_r0_6; | ||
| zNPCCommon* temp_r0_7; | ||
| zNPCCommon* temp_r0_8; | ||
|
Comment on lines
+250
to
+256
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eventually all these unused variables from decompiler output should be cleaned up |
||
|
|
||
| var_r6 = NULL; | ||
| var_ctr = 2; | ||
|
|
||
| for (var_ctr = 0; var_ctr < 16; var_ctr++) | ||
| { | ||
| temp_r0 = this->npcpool[var_ctr].npc; | ||
| if ((temp_r0 != NULL) && (temp_r0 == npc)) | ||
| { | ||
| var_r6 = &this->npcpool[var_ctr]; | ||
| } | ||
| } | ||
|
|
||
| return var_r6; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably some sort of for loop over an array, with
var_r29andvar_r30being compiler generated variables related to indexing an array.