summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
Diffstat (limited to 'src/code')
-rw-r--r--src/code/m_lib.c6
-rw-r--r--src/code/m_start_data_init.c194
2 files changed, 100 insertions, 100 deletions
diff --git a/src/code/m_lib.c b/src/code/m_lib.c
index 3c7d927..f39845d 100644
--- a/src/code/m_lib.c
+++ b/src/code/m_lib.c
@@ -203,12 +203,12 @@ void inter_float(f32* pValue, f32 arg1, s32 stepCount) {
}
}
-void stick_ratio_set(f32* radius, s16* angle, Input* input) {
+void stick_ratio_set(f32* magnitude, s16* angle, Input* input) {
f32 relX = input->rel.stick_x;
f32 relY = input->rel.stick_y;
- *radius = sqrtf(SQ(relX) + SQ(relY));
- *radius = (*radius > 60.0f) ? 60.0f : *radius;
+ *magnitude = sqrtf(SQ(relX) + SQ(relY));
+ *magnitude = (*magnitude > 60.0f) ? 60.0f : *magnitude;
*angle = atans_table(relY, -relX);
}
diff --git a/src/code/m_start_data_init.c b/src/code/m_start_data_init.c
index f920741..cfedc6e 100644
--- a/src/code/m_start_data_init.c
+++ b/src/code/m_start_data_init.c
@@ -68,22 +68,22 @@ void decide_fruit(u16* fruit) {
*fruit = ITM_FOOD_START | (u16)RANDOM_F(n);
}
-void decide_fish_location(u8* fish_location) {
- *fish_location = RANDOM_F(3);
+void decide_fish_location(u8* fishLocation) {
+ *fishLocation = RANDOM_F(3);
}
void title_game_haniwa_data_init(void) {
s32 i;
- char haniwa_buf[HANIWA_MESSAGE_LEN];
+ char haniwaBuf[HANIWA_MESSAGE_LEN];
s32 j;
Haniwa_c* haniwa;
- mString_Load_StringFromRom(haniwa_buf, HANIWA_MESSAGE_LEN, 0x55C);
+ mString_Load_StringFromRom(haniwaBuf, HANIWA_MESSAGE_LEN, 0x55C);
for (i = 0; i < mHS_HOUSE_NUM; i++) {
haniwa = &common_data.homes[i].haniwa;
- mem_copy(common_data.homes[i].haniwa.message, (u8*)haniwa_buf, HANIWA_MESSAGE_LEN);
+ mem_copy(common_data.homes[i].haniwa.message, (u8*)haniwaBuf, HANIWA_MESSAGE_LEN);
for (j = 0; j < HANIWA_ITEM_HOLD_NUM; j++) {
haniwa->items[j].item = EMPTY_NO;
@@ -94,29 +94,29 @@ void title_game_haniwa_data_init(void) {
void mSDI_ClearMoneyPlayerHomeStationBlock(void) {
static s32 block_num[2][2] = {
- { 2, 1 }, /* Player home */
- { 2, 0 } /* Station */
+ { 2, 1 }, // Player home
+ { 2, 0 } // Station
};
- s32 block_z;
- s32 block_x;
+ s32 blockZ;
+ s32 blockX;
u16* items;
- s32 ut_x;
- s32 ut_z;
+ s32 utX;
+ s32 utZ;
u16 item;
s32 i;
s32 depositOffset;
for (i = 0; i < 2; i++) {
- block_z = block_num[i][1];
- block_x = block_num[i][0];
+ blockZ = block_num[i][1];
+ blockX = block_num[i][0];
- depositOffset = block_num[i][1] * FG_BLOCK_X_NUM + block_x;
- items = common_data.foreground[block_z][block_x].items[0];
+ depositOffset = block_num[i][1] * FG_BLOCK_X_NUM + blockX;
+ items = common_data.foreground[blockZ][blockX].items[0];
if (items != NULL) {
- for (ut_z = 0; ut_z < UT_Z_NUM; ut_z++) {
- for (ut_x = 0; ut_x < UT_X_NUM; ut_x++) {
+ for (utZ = 0; utZ < UT_Z_NUM; utZ++) {
+ for (utX = 0; utX < UT_X_NUM; utX++) {
item = *items;
if (item >= ITM_MONEY_START && item <= ITM_MONEY_END) {
@@ -126,7 +126,7 @@ void mSDI_ClearMoneyPlayerHomeStationBlock(void) {
*items = EMPTY_NO;
if (deposit != NULL) {
- mFI_BlockDepositOFF(deposit, ut_x, ut_z);
+ mFI_BlockDepositOFF(deposit, utX, utZ);
}
}
@@ -137,33 +137,33 @@ void mSDI_ClearMoneyPlayerHomeStationBlock(void) {
}
}
-void mSDI_PullTreeUT(u16* item_p) {
- if ((*item_p >= TREE_SAPLING && *item_p <= TREE_30000BELLS) ||
- (*item_p >= TREE_100BELLS_SAPLING && *item_p <= TREE_100BELLS)) {
- *item_p = EMPTY_NO;
+void mSDI_PullTreeUT(u16* itemP) {
+ if ((*itemP >= TREE_SAPLING && *itemP <= TREE_30000BELLS) ||
+ (*itemP >= TREE_100BELLS_SAPLING && *itemP <= TREE_100BELLS)) {
+ *itemP = EMPTY_NO;
}
}
-void mSDI_PullTreeBlock(u16* items_p, s32 ut) {
+void mSDI_PullTreeBlock(u16* itemsP, s32 ut) {
s32 i;
for (i = ut; i < UT_TOTAL_NUM; i += UT_X_NUM) {
- mSDI_PullTreeUT(&items_p[i]);
+ mSDI_PullTreeUT(&itemsP[i]);
}
}
void mSDI_PullTree(void) {
- Foreground* fg_block;
- s32 block_z;
-
- for (block_z = 0; block_z < FG_BLOCK_Z_NUM; block_z++) {
- /* Clear trees against the cliffs on the left and right town cliff borders */
- fg_block = &common_data.foreground[block_z][0];
- mSDI_PullTreeBlock(fg_block->items[0], 0);
- mSDI_PullTreeBlock((fg_block + FG_BLOCK_X_NUM - 1)->items[0], UT_X_NUM - 1);
+ Foreground* fgBlock;
+ s32 blockZ;
+
+ for (blockZ = 0; blockZ < FG_BLOCK_Z_NUM; blockZ++) {
+ // Clear trees against the cliffs on the left and right town cliff borders
+ fgBlock = &common_data.foreground[blockZ][0];
+ mSDI_PullTreeBlock(fgBlock->items[0], 0);
+ mSDI_PullTreeBlock((fgBlock + FG_BLOCK_X_NUM - 1)->items[0], UT_X_NUM - 1);
}
- if (fg_block) {}
+ if (fgBlock) {}
}
void mSDI_PullTreeUnderPlayerBlock(void) {
@@ -184,10 +184,10 @@ void mSDI_PullTreeUnderPlayerBlock(void) {
mSDI_PullTreeUT(&items[16 + 8]);
}
-s32 mSDI_StartInitNew(Game* game2, s32 player_no, s32 malloc_flag) {
+s32 mSDI_StartInitNew(Game* game2, s32 playerNumber, s32 mallocFlag) {
Game_Play* game_play = (Game_Play*)game2;
- PrivateInfo* priv;
- PrivateInfo* priv_p;
+ PrivateInfo* privateInfo;
+ PrivateInfo* privateInfoPointer;
Game* game = NULL;
s32 i;
UNUSED s32 pad[2];
@@ -195,14 +195,14 @@ s32 mSDI_StartInitNew(Game* game2, s32 player_no, s32 malloc_flag) {
common_data.sceneFromTitleDemo = SCENE_START_DEMO;
lbRTC_GetTime(&common_data.time.rtcTime);
- priv = &common_data.saveFilePrivateInfo[player_no];
- common_data.privateInfo = priv;
- common_data.playerNumber = player_no;
+ privateInfo = &common_data.saveFilePrivateInfo[playerNumber];
+ common_data.privateInfo = privateInfo;
+ common_data.playerNumber = playerNumber;
common_data.privateInfo->gender = mPr_SEX_MALE;
decide_fruit(&common_data.fruit);
- if (malloc_flag == 0) {
+ if (mallocFlag == 0) {
game = game2;
}
@@ -214,22 +214,22 @@ s32 mSDI_StartInitNew(Game* game2, s32 player_no, s32 malloc_flag) {
mFM_SetBlockKindLoadCombi(game);
mAGrw_ChangeTree2FruitTree();
- priv_p = &common_data.saveFilePrivateInfo[0];
+ privateInfoPointer = &common_data.saveFilePrivateInfo[0];
mMld_SetDefaultMelody();
mLd_LandDataInit();
mEv_ClearEventSaveInfo(&common_data.eventSaveInfo);
mEv_init(&game_play->event);
- mNpc_InitNpcAllInfo(malloc_flag);
+ mNpc_InitNpcAllInfo(mallocFlag);
for (i = 0; i < PLAYER_NUM; i++) {
- mPr_ClearPrivateInfo(priv_p);
- priv_p++;
+ mPr_ClearPrivateInfo(privateInfoPointer);
+ privateInfoPointer++;
}
- priv_p += player_no;
- priv_p -= PLAYER_NUM;
- mPr_InitPrivateInfo(priv_p);
+ privateInfoPointer += playerNumber;
+ privateInfoPointer -= PLAYER_NUM;
+ mPr_InitPrivateInfo(privateInfoPointer);
mNpc_SetRemoveAnimalNo(common_data.animals);
title_game_haniwa_data_init();
mPB_police_box_init(game);
@@ -260,13 +260,13 @@ s32 mSDI_StartInitNew(Game* game2, s32 player_no, s32 malloc_flag) {
return TRUE;
}
-s32 mSDI_StartInitFrom(Game* game2, s32 player_no, s32 malloc_flag) {
+s32 mSDI_StartInitFrom(Game* game2, s32 playerNumber, s32 mallocFlag) {
Game_Play* game_play = (Game_Play*)game2;
- PrivateInfo* priv;
+ PrivateInfo* privateInfo;
Game* game = game2;
s32 res = FALSE;
- if (malloc_flag != 0) {
+ if (mallocFlag != 0) {
game = NULL;
}
@@ -274,37 +274,37 @@ s32 mSDI_StartInitFrom(Game* game2, s32 player_no, s32 malloc_flag) {
lbRTC_GetTime(&common_data.time.rtcTime);
if (mFRm_CheckSaveData() == TRUE) {
- priv = &common_data.saveFilePrivateInfo[player_no];
- if (mPr_CheckPrivate(priv) == TRUE) {
- if (priv->exists == TRUE) {
- common_data.privateInfo = priv;
- common_data.playerNumber = player_no;
+ privateInfo = &common_data.saveFilePrivateInfo[playerNumber];
+ if (mPr_CheckPrivate(privateInfo) == TRUE) {
+ if (privateInfo->exists == TRUE) {
+ common_data.privateInfo = privateInfo;
+ common_data.playerNumber = playerNumber;
mFM_SetBlockKindLoadCombi(game);
mEv_init_force(&game_play->event);
- mHsRm_GetHuusuiRoom(game, player_no);
+ mHsRm_GetHuusuiRoom(game, playerNumber);
mSP_ExchangeLineUp_InGame(game);
mNpc_SetRemoveAnimalNo(common_data.animals);
- mCkRh_DecideNowGokiFamilyCount(player_no);
+ mCkRh_DecideNowGokiFamilyCount(playerNumber);
mMkRm_MarkRoom(game);
res = TRUE;
} else {
common_data.player_decoy_flag = TRUE;
- priv->exists = TRUE;
- common_data.privateInfo = priv;
- common_data.playerNumber = player_no;
+ privateInfo->exists = TRUE;
+ common_data.privateInfo = privateInfo;
+ common_data.playerNumber = playerNumber;
mFM_SetBlockKindLoadCombi(game);
- mHsRm_GetHuusuiRoom(game, player_no);
+ mHsRm_GetHuusuiRoom(game, playerNumber);
mSP_ExchangeLineUp_InGame(game);
mNpc_SetRemoveAnimalNo(common_data.animals);
- bzero(priv->inventory.pockets, sizeof(priv->inventory.pockets));
- priv->inventory.lotto_ticket_expiry_month = 0;
- priv->inventory.lotto_ticket_mail_storage = 0;
- priv->inventory.item_conditions = 0;
- priv->inventory.wallet = 0;
- mQst_ClearDelivery(priv->deliveries, mPr_DELIVERY_QUEST_NUM);
- mQst_ClearErrand(priv->errands, mPr_ERRAND_QUEST_NUM);
- mCkRh_DecideNowGokiFamilyCount(player_no);
+ bzero(privateInfo->inventory.pockets, sizeof(privateInfo->inventory.pockets));
+ privateInfo->inventory.lotto_ticket_expiry_month = 0;
+ privateInfo->inventory.lotto_ticket_mail_storage = 0;
+ privateInfo->inventory.item_conditions = 0;
+ privateInfo->inventory.wallet = 0;
+ mQst_ClearDelivery(privateInfo->deliveries, mPr_DELIVERY_QUEST_NUM);
+ mQst_ClearErrand(privateInfo->errands, mPr_ERRAND_QUEST_NUM);
+ mCkRh_DecideNowGokiFamilyCount(playerNumber);
mMkRm_MarkRoom(game);
res = TRUE;
}
@@ -313,24 +313,24 @@ s32 mSDI_StartInitFrom(Game* game2, s32 player_no, s32 malloc_flag) {
return res;
}
-s32 mSDI_StartInitNewPlayer(Game* game, s32 player_no, s32 malloc_flag) {
+s32 mSDI_StartInitNewPlayer(Game* game, s32 playerNumber, s32 mallocFlag) {
Game_Play* game_play = (Game_Play*)game;
- PrivateInfo* priv;
+ PrivateInfo* privateInfo;
s32 res = FALSE;
UNUSED s32 pad;
common_data.sceneFromTitleDemo = SCENE_START_DEMO2;
lbRTC_GetTime(&common_data.time.rtcTime);
- priv = &common_data.saveFilePrivateInfo[player_no];
+ privateInfo = &common_data.saveFilePrivateInfo[playerNumber];
if (mFRm_CheckSaveData() == TRUE) {
- if (mPr_CheckPrivate(priv) != TRUE) {
- mPr_InitPrivateInfo(priv);
- common_data.privateInfo = priv;
+ if (mPr_CheckPrivate(privateInfo) != TRUE) {
+ mPr_InitPrivateInfo(privateInfo);
+ common_data.privateInfo = privateInfo;
mPr_SetPossessionItem(common_data.privateInfo, 0, ITM_MONEY_1000, mPr_ITEM_COND_QUEST);
- common_data.playerNumber = player_no;
+ common_data.playerNumber = playerNumber;
common_data.privateInfo->gender = mPr_SEX_MALE;
- if (malloc_flag == 0) {
+ if (mallocFlag == 0) {
mFM_SetBlockKindLoadCombi(game);
mEv_init_force(&game_play->event);
mSP_ExchangeLineUp_InGame(game);
@@ -347,32 +347,32 @@ s32 mSDI_StartInitNewPlayer(Game* game, s32 player_no, s32 malloc_flag) {
return res;
}
-s32 mSDI_StartInitPak(Game* game2, s32 player_no, s32 malloc_flag) {
+s32 mSDI_StartInitPak(Game* game2, s32 playerNumber, s32 mallocFlag) {
Game* game = game2;
Game_Play* game_play = (Game_Play*)game;
UNUSED s32 pad;
s32 res = FALSE;
s32 sp1C;
- if (malloc_flag == 1) {
+ if (mallocFlag == 1) {
game = NULL;
}
- if (player_no < 5) {
+ if (playerNumber < 5) {
common_data.sceneFromTitleDemo = SCENE_FG;
}
if (mFRm_CheckSaveData() == TRUE) {
sp1C = mCPk_get_pkinfo();
- if ((func_80078E90_jp(sp1C, 0) == TRUE) && (func_800B8D64_jp(player_no, sp1C) == TRUE)) {
+ if ((func_80078E90_jp(sp1C, 0) == TRUE) && (func_800B8D64_jp(playerNumber, sp1C) == TRUE)) {
mFM_SetBlockKindLoadCombi(game);
mEv_init_force(&game_play->event);
- mHsRm_GetHuusuiRoom(game, player_no);
+ mHsRm_GetHuusuiRoom(game, playerNumber);
mSP_ExchangeLineUp_InGame(game);
mNpc_SetRemoveAnimalNo(common_data.animals);
mNpc_SetReturnAnimal(mNpc_GetInAnimalP());
mNpc_SendRegisteredGoodbyMail();
- mCkRh_DecideNowGokiFamilyCount(player_no);
+ mCkRh_DecideNowGokiFamilyCount(playerNumber);
mMkRm_MarkRoom(game);
mEv_SetGateway();
res = TRUE;
@@ -381,11 +381,11 @@ s32 mSDI_StartInitPak(Game* game2, s32 player_no, s32 malloc_flag) {
return res;
}
-s32 mSDI_StartInitErr(UNUSED Game* game, UNUSED s32 player_no, UNUSED s32 malloc_flag) {
+s32 mSDI_StartInitErr(UNUSED Game* game, UNUSED s32 playerNumber, UNUSED s32 mallocFlag) {
return TRUE;
}
-void mSDI_StartInitAfter(Game* game, s32 renewal_reserve_flag, s32 malloc_flag) {
+void mSDI_StartInitAfter(Game* game, s32 renewalReserveFlag, s32 mallocFlag) {
Game_Play* game_play = (Game_Play*)game;
common_data.houseOwnerName = -1;
@@ -404,9 +404,9 @@ void mSDI_StartInitAfter(Game* game, s32 renewal_reserve_flag, s32 malloc_flag)
func_80096B64_jp();
mNpc_InitNpcData();
mNpc_InitNpcList();
- mNpc_SetNpcList(common_data.npclist, common_data.animals, ANIMAL_NUM_MAX, malloc_flag);
+ mNpc_SetNpcList(common_data.npclist, common_data.animals, ANIMAL_NUM_MAX, mallocFlag);
mNpc_ClearTalkInfo();
- if (renewal_reserve_flag == 1) {
+ if (renewalReserveFlag == 1) {
mFM_RenewalReserve();
}
mQst_ClearNotSaveQuest(&common_data.quest);
@@ -428,30 +428,30 @@ void mSDI_StartInitAfter(Game* game, s32 renewal_reserve_flag, s32 malloc_flag)
mPr_RenewalMapInfo(common_data.privateInfo->maps, mPr_FOREIGN_MAP_COUNT, &common_data.landInfo);
}
-typedef s32 (*mSDI_INIT_PROC)(Game*, s32, s32);
+typedef s32 (*StartDataInitProcess)(Game*, s32, s32);
-s32 mSDI_StartInitBefore(Game* game, s32 player_no, s32 init_mode, s32 malloc_flag) {
- static mSDI_INIT_PROC init_proc[mSDI_INIT_MODE_NUM] = {
+s32 mSDI_StartInitBefore(Game* game, s32 playerNumber, s32 initMode, s32 mallocFlag) {
+ static StartDataInitProcess init_proc[] = {
mSDI_StartInitNew, mSDI_StartInitNewPlayer, mSDI_StartInitFrom, mSDI_StartInitPak, mSDI_StartInitErr,
};
mEv_UnSetGateway();
- return init_proc[init_mode](game, player_no, malloc_flag);
+ return init_proc[initMode](game, playerNumber, mallocFlag);
}
-s32 mSDI_StartDataInit(Game* game, s32 player_no, s32 init_mode) {
- static int renew_reserve_mode_table[mSDI_INIT_MODE_NUM] = {
+s32 mSDI_StartDataInit(Game* game, s32 playerNumber, s32 initMode) {
+ static int renew_reserve_mode_table[] = {
TRUE, FALSE, FALSE, FALSE, FALSE,
};
s32 res;
- if ((init_mode < mSDI_INIT_MODE_NEW) || (init_mode >= mSDI_INIT_MODE_NUM)) {
- init_mode = mSDI_INIT_MODE_NEW;
+ if ((initMode < mSDI_INIT_MODE_NEW) || (initMode >= mSDI_INIT_MODE_NUM)) {
+ initMode = mSDI_INIT_MODE_NEW;
}
- res = mSDI_StartInitBefore(game, player_no, init_mode, mSDI_MALLOC_FLAG_ZELDA);
+ res = mSDI_StartInitBefore(game, playerNumber, initMode, mSDI_MALLOC_FLAG_ZELDA);
if (res == TRUE) {
- mSDI_StartInitAfter(game, renew_reserve_mode_table[init_mode], mSDI_MALLOC_FLAG_ZELDA);
+ mSDI_StartInitAfter(game, renew_reserve_mode_table[initMode], mSDI_MALLOC_FLAG_ZELDA);
}
return res;