Files
tww/src/d/d_menu_cloth.cpp
T
Briggs Baltzell 547284c1de Equivalent d_menu_window (#943)
* Add definitions for `l_dMs_Method` and `g_profile_MENUWINDOW` in `d_menu_window` and update includes.

* Update `d_menu_window` to include `d_meter` and implement `dMs_IsDelete` function.

* Update `d_menu_window` to add `mButtonsPressed` field and implement button bit manipulation functions.

* Match dMs_isPush_L_Button and dMs_isPush_R_Button

* Match `dMs_childHeap_freeAll`

* Extend `sub_ms_screen_class` from `msg_class` in `d_menu_window`.

* Implement `draw` methods for `dDlst_MENU_CAPTURE_c` and `dDlst_MENU_CLOTH_c` in `d_menu_window`.

* Implement non-matching portions of `dDlst_MENU_CLOTH_c::draw` in `d_menu_window` and update includes.

* Extend `dMw_HIO_c` and `dMw_DHIO_c` from `JORReflexible` in `d_menu_window` and add virtual destructors.

* Match `dMs_isButtonBit` and use TRUE and FALSE in other methods

* Add `dMenu_setMenuStatus` declaration to `d_meter` header

* Refactor `d_menu_window` to expand `sub_ms_screen_class` fields and add external `dMw_HIO_c` and `dMw_DHIO_c` instances.

* Initialize new fields in `d_menu_window`, add font-related setup in `dMs_Create`, and update heap and timer logic.

* Add `getItemResArchive` method to `d_com_inf_game`

* Expand `sub_ms_screen_class` with new fields and initialize them in `dMs_item_create`.

* Abstract menu functionality into a new `dMenu_base_c` class and update `dMenu_Collect_c` and `dMenu_Item_c` to inherit from it.

* Add `dMenu_Item_c` instance and include in `d_menu_window`

* Add new menu-related includes and static instances to `d_menu_window`

* Reorder `d_menu_window` static instances and adjust font-related declarations.

* Initialize `dMi_c` instance in `d_menu_window`.

* Extend `dMenu_Dmap_c` to inherit from `dMenu_base_c` and update methods to be virtual.

* Refactor vertex setup in `d_menu_window` to use 3D positions and texture coordinates with new attribute formats.

* Add `dMenu_Fmap2_c` instance and related updates to `dMenu_Fmap_c`

* Add `dDlst_FMAP2_c` and `dDlst_FMAP2GS_c` instances to `dMenu_Fmap2_c` and adjust structure padding

* Update include path for `d_menu_fmap2.h` in `d_menu_fmap.h`

* Add `dComIfGp_event_photoCheck` inline function to `d_com_inf_game`

* Update `d_menu_window` structure: replace `field_0x108` with `mMsgID` and modify `field_0x1B0` type to `u16`

* Match `dMs_telescopeMove`

* Match `dMs_placenameMove` logic

* Make `dMi_HIO_c` inherit from `JORReflexible` and add a virtual destructor.

* Introduce global instance `g_miHIO` of `dMi_HIO_c` in `d_menu_item`.

* Declare new member variables in `dMi_HIO_c`.

* Set `g_miHIO.mNo` with child HIO creation for "Item Screen" in `dMenu_Item_c::_create`.

* Expand `dMi_HIO_c` with new member variables and define `ARR_SIZE` constant.

* Match `dMi_HIO_c` constructor logic and update structure to include `mColor0`.

* Correct `mColor0` type casting in `dMi_HIO_c` constructor.

* Replace `mColor0` and `field_0x50` with `JUtility::TColor` members in `dMi_HIO_c` and update initialization logic.

* Retrieve colors from `g_miHIO` for `GXColor` initialization in `dMenu_Window_c`.

* Rename `mColor1`/`mColor2` to `mClothColor`/`mShadowColor` in `dMenu_Item_c` and update references accordingly.

* Match `dDlst_MENU_CLOTH_c::draw`

* Expand `dMw_HIO_c` structure with new member variables and update padding/array definitions.

* Expand `dMw_DHIO_c` structure with new array and padding definitions.

* Match `dMw_DHIO_c` constructor logic by initializing `arr_0x05` elements to zero.

* Match `dMw_HIO_c::dMw_HIO_c`: expand `dMw_HIO_c` structure with additional member variables and initialize them in the constructor.

* Add `setPictureStatus` function and its inline wrapper `dComIfGp_setPictureStatus`.

* Add `mDoExt_getCurrentHeap` function declaration to `m_Do_ext.h`.

* Match `dMs_Delete` function logic.

* Match `dMs_Delete` function logic by updating conditions and removing obsolete comments.

* Add `dMenu_getMenuStatus` function declaration to `d_meter.h`.

* Match `dMenu_Fmap_c::draw` logic by calling `_draw()`.

* Match `dMs_Draw` function logic by updating conditions and adding new menu status handling.

* Expand `d_menu_window` structure by adding `dMw_Status` enum and `mMenuProc` member variable.

* Add `fmapOpenCheck`, `fmapOpenOff` functions and their inline wrappers

* Add `dMenu_setMenuStatusOld` function declaration to `d_meter.h`.

* Update `noteCheck` return type to `u32` in `d_menu_dmap`.

* Expand `d_menu_dmap` structure by adding new fields and member variables.

* Change `noteCheck` return type to `bool` and update logic to match field condition

* Rename `field_0x4952` to `mNameOpen` and update related functions. Add inline wrappers for `nameOpenOn` and `nameOpenCheck`.

* Change `mMenuCollect` type to `bool` and add corresponding inline wrapper functions

* Change `mFmapOpen` type to `u8` and update related functions and inline wrappers

* Expand `d_menu_item` structure by adding new fields and member variables.

* Expand `d_menu_collect` structure by adding new fields and member variables.

* Add `dMenu_getCollectMode`, `dMenu_setCollectMode`, `dMenu_getItemMode`, and `dMenu_setItemMode` function declarations to `d_meter.h`.

* Change `_open` methods to return `bool` in `d_menu_collect`, `d_menu_dmap`, and `d_menu_item` classes and update virtual declarations.

* Change `_open3` and `_close2` return types to `bool` in `d_menu_collect` and update virtual declarations.

* Update `_open2` and `_close2` methods in `d_menu_collect` and `d_menu_item` to return `bool` and adjust related declarations and structures.

* Rename `field_0x4952` to `mNameOpen` in `d_menu_window` for consistency with updated naming conventions.

* Change `noteCheck` return type to `u8` in `d_menu_item` and update related structure fields and declarations. Add `dMeter_subWinFlag` function declaration.

* Update `dMw_Status` enum in `d_menu_window` to replace placeholder names with descriptive identifiers.

* Match `dMs_Execute` method in `d_menu_window` 50.00%

* Implement `MW_STATUS_UNK_36`, `MW_STATUS_UNK_37`, and `MW_STATUS_UNK_38` logic in `d_menu_window`.

* Update `dMw_Status` enum and replace placeholder names with descriptive identifiers in `d_menu_window`.

* Update `dMw_Status` enum in `d_menu_window` with descriptive identifiers and replace usages accordingly

* Update `dMw_Status` enum by replacing unknown placeholder names with descriptive identifiers and adjust related logic

* Replace hardcoded timer threshold `0xF6` with `g_menuHIO.field_0x90` in `d_menu_window` logic.

* Change `_close` method return type to `bool` in `d_menu_collect`, `d_menu_dmap`, and `d_menu_item`, and update related declarations.

* Implement logic for `MW_STATUS_UNK_5` and `MW_STATUS_UNK_16/19` in `d_menu_window`

* Change `_open` and `_close` methods return type to `bool` in `d_menu_fmap` and update related declarations.

* Change `_open` methods return type to `bool` in `d_menu_fmap` and update related declarations and implementations.

* Implement `_open` logic for various `MW_STATUS_FMAP` states in `d_menu_window`.

* Change `isFmapClose` return type to `bool` in `d_menu_fmap` and update its implementation.

* Implement movement and close logic for various `MW_STATUS_FMAP` states in `d_menu_window`.

* Add `nameOpenChangeOff` and `nameOpenCancelOff` methods to manage `mNameOpen` state

* Implement `_open`, `_move`, and `_close` logic for `MW_STATUS_NAME_*` states in `d_menu_window`.

* Update button lock logic in `d_menu_window` to use `mDoCPd_L_LOCK_BUTTON`.

* Refactor `dMenu_setCollectMode` logic in `d_menu_window` for clarity and consistency.

* Add `STATIC_ASSERT` for `dMenu_Collect_c` size and fix `m27A0` to `m2780`

* Update button bit handling logic in `d_menu_window` and clean up redundant code

* Decrease item record timer conditionally in `d_menu_window`.

* Implement `decItemTimer` logic in `d_com_inf_game` and integrate with `dComIfGp_decItemTimer`.

* Integrate `dComIfGp_decItemTimer` call in `d_menu_window`.

* Change `getButtonIconMode` return type to `u8` and implement placeholder return value.

* Move `dMeter_Info` declaration from `d_msg.cpp` to `d_meter.h`.

* Set `dMeter_Info.field_0x1` based on `dMf_c` state in `d_menu_window`.

* Rename `field_0x1` to `mButtonIconMode` in `dMeter_Info` for clarity and consistency.

* Update `MW_STATUS_FMAP_MOVE_WALLPAPER` logic to handle additional button triggers and call `_move` when applicable. Clean up redundant code.

* Handle `MW_STATUS_DMAP_CLOSE` in `d_menu_window` by invoking `_close` and cleaning up related resources.

* Update `MW_STATUS_DMAP_MOVE` button triggers and replace `_close` with `_move` in `d_menu_window`.

* Handle `MW_STATUS_DMAP_OPEN` logic by invoking `_open` and transitioning to `MW_STATUS_DMAP_MOVE` in `d_menu_window`.

* Change `_close3` return type from `void` to `bool` in `dMenu_Collect_c`.

* Handle `MW_STATUS_UNK_20` logic by invoking `_close3`, cleaning up resources, and resetting menu state in `d_menu_window`.

* Refactor redundant condition checks in `d_menu_window` by introducing `CAN_PROCEED` macro for clarity and reuse.

* Simplify condition checks in `d_menu_window` by consolidating `CAN_PROCEED` logic into a single `if-else` chain.

* Update `event_wait_frame` type to signed and adjust condition checks in `d_menu_window` for better logic clarity.

* Handle `MW_STATUS_ITEM_OPEN1_1` logic by initializing heap, creating item, and updating menu state in `d_menu_window`.

* Handle `MW_STATUS_FMAP_OPEN` and `MW_STATUS_DMAP_OPEN` logic by introducing button checks, creating menu states, and playing audio cues in `d_menu_window`.

* Update `noteCheck` return type to `u8` and adjust struct layout in `dMenu_Collect_c`.

* Handle button press logic and update menu state transitions in `MW_STATUS_UNK_13` within `d_menu_window`.

* Simplify button press handling logic by restructuring nested conditionals in `d_menu_window`.

* Handle `MW_STATUS_UNK_14` logic by adding button checks, updating menu state, and playing audio cues in `d_menu_window`.

* Handle `MW_STATUS_UNK_15` logic by adding condition checks, updating menu state, initializing heap, and triggering audio cues in `d_menu_window`.

* Refactor `mMenuProc` handling by replacing `switch-case` statements with `if-else` chains in `d_menu_window`.

* Initialize `timer` to 0 in `dMs_Execute` and add a newline for readability in `d_menu_window`.

* Refactor `mMenuProc` handling by introducing a `menuProc` local variable for improved readability and reduced redundancy in `d_menu_window`.

* Simplify conditionals and improve menu handling logic in `d_menu_window`.

* Replace `menuProc` variable usage with direct access to `i_Ms->mMenuProc` to reduce redundancy in `d_menu_window`.

* Refactor conditional checks and streamline button press handling in `d_menu_window`.

* Refactor conditional checks and improve readability in button press handling logic within `d_menu_window`.

* Match `dMs_Execute`

* Refactor `dMw_Status` enum to `MENU_STATE`, clarify naming conventions, and update all references in `d_menu_window`.

* Refactor `fwaterTimer` logic by replacing direct member access with helper functions for improved readability in `d_menu_window`.

* Add `dMenu_FmapSv_c` class definition to `d_menu_fmap` header.

* Initialize fields in `dMenu_FmapSv_c` constructor in `d_menu_fmap` header.

* Add `dMenu_FmapSv_c` declaration and definition to `d_menu_window`.

* Replace `TODO` with initialization of `dMv_CIO_c` using `dMenu_FmapSv_c` in `d_menu_window`.

* Adjust initialization value of `field_0x9` in `d_menu_fmap` header.

* Fix incorrect assertion parameter in `d_menu_window` for `rfonttype`.

* Add `dummy_arr` array and remove non-matching comment in `d_menu_window`

* Add padding fields and `mSvPtr` member to `dMenu_Fmap_c` with a size assertion

* Set `mSvPtr` in `setSvPtr` method in `d_menu_fmap` header.

* Move `dDlst_FMAP_c` class definition and integrate into `dMenu_Fmap_c`.

* Replace padding with `J2DScreen* scrn` in `dMenu_Fmap_c`.

* Introduce `MenuStatus` enum and replace menu status magic numbers with enum constants.

* Update `mMsgID` initialization to use `fpcM_ERROR_PROCESS_ID_e` in `d_menu_window`

* Replace direct `g_dComIfG_gameInfo.play` calls with new `dComIfGp_` helper functions in `d_menu_window`.

* Match `dMs_name_create`

* Match `dMs_name_delete`

* Add new button bit function declarations, initialize `dMenu_Item_c` fields, and update `d_menu_item` structure with new members

* Refactor `d_menu_item` structure to use arrays for `name`, `note`, and `dummy` fields instead of individual members.

* Update `d_menu_item` methods to initialize member variables instead of using empty bodies.

* Refactor `dMs_item_create` to use setter methods for `dMenu_Item_c` initialization.

* Update `setTextArea` to assign parameters to arrays and refactor structure to include `name`, `note`, and `dummy` arrays

* Refactor `setTextArea` to initialize arrays and update structure with `name`, `note`, and `dummy` fields.

* Refactor `setTextArea_New` to initialize arrays and update `dMenu_Fmap_c` structure with `name`, `note`, and `dummy` fields.

* Match `dMs_save_delete`

* Refactor `setFont` method and update member variables `m2470` and `m2474` to `mFont` and `mRFont` respectively

* Refactor `setFont` method to assign `mFont` and `mRFont`, and update `d_menu_dmap_c` structure to include new font-related members

* Update `setArchive` method to assign `mpArc` and modify `d_menu_dmap_c` structure to include `mpArc` member

* Add static assert to verify `dMenu_Dmap_c` structure size

* Refactor `setFont` method to assign `mFont` and `mRFont`, and update `dMenu_Fmap_c` structure to include new font-related members

* Add `getDmapResArchive` method to retrieve `mpDmapResArchive`

* Refactor `d_menu_dmap_c` structure to replace padding with `arr_0x1AFC` array and update `mMsgProc` definition.

* Match `dMs_dmap_create` implementation to initialize required buffers, fields, and objects.

* Match `dMs_dmap_delete` implementation to properly free allocated resources and reset pointers.

* Match `dMs_item_delete` implementation to properly free allocated resources and reset pointers.

* Add parameter names to `dMs_collect_create`, `dMs_collect_create2`, `dMs_collect_delete`, `dMs_fmap_create`, and `dMs_fmap_delete` functions.

* Add getter methods for `CollectResArchive`, `OptionResArchive`, and `SaveResArchive`

* Refactor `d_menu_collect` structure to update archive and texture buffer setters, and adjust member definitions

* Match `dMs_collect_create` implementation to initialize resources, allocate buffers, and set up archives and objects.

* Refactor `d_menu_collect` to update texture buffer setters, adjust resource handling, and clean up formatting.

* Refactor `d_menu_window` to use texture buffer setter methods instead of direct member assignments.

* Refactor `d_menu_collect` to rename texture buffer variables and update related member definitions and methods.

* Refactor `d_menu_collect` to clean up formatting

* Add `tact_beat` array to define the number of beats for each baton song in `d_menu_collect`.

* Refactor `d_menu_collect` to replace alpha assignments with `show` method calls for improved readability.

* Refactor `d_menu_collect` to standardize hexadecimal offsets with consistent padding.

* Refactor `d_menu_collect` to use `alphaChange` method for modifying alpha values

* Refactor `d_menu_collect` to add `setTimer` method and replace direct `m27E2` assignments with method calls.

* Refactor `d_menu_collect` to use local `archive` variable for consistent resource handling and improved readability.

* Refactor `d_menu_collect` to update text pane color values for consistency.

* Change `d_menu_collect` to use different pane data array.

* Refactor `d_menu_collect` to simplify `m18F8` pane data handling and improve readability.

* Refactor `d_menu_collect` to replace pointer with fixed-size array for `print_format` variable.

* Match `dMenu_Collect_c::screenSet`.

* Refactor `dMenu_Collect_c::screenSet` to relocate `print_format` declaration for improved code clarity.

* Match `dMs_collect_create2`.

* Match `dMs_collect_delete`.

* Refactor fields in `dMenu_Fmap_c` and `dMenu_Fmap2_c`.

* Match `dMs_fmap_create`.

* Match `dMs_fmap_delete`.

* Match `dMenu_FmapSv_c` constructor and destructor usage. Refactor `dMv_CIO_c` initialization for explicit field assignment.

* Match `dMenu_FmapSv_c` destructor and expand class with placeholder accessor methods.

* Refactor `dMenu_Fmap_c` to rename `mSvPtr` field to `fmapSv` for consistency.

* Remove unused padding field `padding_0xC5` from `d_menu_window.h`.

* Add `dDlst_NameIN_c` destructor.

* Add static assert for `dName_c` size validation.

* Add placeholder `genMessage` method in `dNm_HIO_c`.

* Add default constructor to `dName_c`.

* Refactor dummy functions in `d_menu_cloth.cpp` and `d_menu_window.cpp` for clarity.

* Match `dMenu_Window_c` for GZLJ01, GZLE01, and GZLP01.

* Match `dMenu_Window_c` and refactor `dDlst_MENU_CLOTH_c` and `dDlst_MENU_CAPTURE_c` methods for improved clarity and update comments for initialization consistency.

* Refactor `dDlst_MENU_CAPTURE_c` to improve clarity by adding draw flag helper methods and simplifying `draw` logic.

* Refactor `d_menu_window.cpp` to replace direct `mStatus` access with draw flag helper methods for improved clarity.

* Extract `dMenu_base_c` to a new header file for improved modularity and update includes accordingly.

* Extract `dDlst_MENU_CLOTH_c` and `dDlst_MENU_CAPTURE_c` into a new header file for improved modularity and update includes.

* Update includes in `d_menu_capture.h` and remove unused include from `d_menu_window.cpp` for consistency and cleanup.

* Extract `dMenu_FmapSv_c` to a new header file for improved modularity and update includes.

* Restrict `dMenu_Window_c` matching to GZLE01 only.

* Add `title_p` field to `dMenu_Window_c` for PAL version and allocate memory in `d_menu_window.cpp`.

* Update `d/d_menu_window.cpp` to use `Equivalent` instead of `MatchingFor("GZLE01")`.

* Rename `nameOpen` methods to `InputPasswordOpen` in `d/d_menu_window.cpp` and `d_com_inf_game.h` for clarity.

* Make `dummy` functions static in `d_menu_cloth.cpp` and `d_menu_window.cpp` to limit their scope.

* Update `g_profile_MENUWINDOW` definitions in `d/d_menu_window.cpp` for consistency with type usage and naming conventions.

* Remove outdated comments from `d_menu_fmap.h` and `d_menu_item.cpp`.

* Restore `InputPasswordOpen` methods in `d_com_inf_game.h`.
2026-03-31 19:54:00 -04:00

994 lines
34 KiB
C++

//
// Generated by dtk
// Translation Unit: d_menu_cloth.cpp
//
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_menu_cloth.h"
#include "d/d_procname.h"
#include "d/d_priority.h"
#include "assets/l_matDL__d_menu_cloth.h"
static daCLOTH_HIO_c l_HIO;
s16 dMCloth_c::init_angle_z = 0;
#define HIO_CHILD (l_HIO.mChildren[mClothType])
/* 8019940C-8019966C .text __ct__13daCLOTH_HIO_cFv */
daCLOTH_HIO_c::daCLOTH_HIO_c() {
mNo = -1;
// Default
{
const f32 scale = VERSION_SELECT(1.75f, 1.75f, 1.78f, 1.78f);
mChildren[MENU_CLOTH_TYPE_DEFAULT].scale.set(scale, scale, 1.0f);
mChildren[MENU_CLOTH_TYPE_DEFAULT].rot.setall(0);
mChildren[MENU_CLOTH_TYPE_DEFAULT].pos.set(360.0f, 40.0f, -2400.0f);
// Middle green
mChildren[MENU_CLOTH_TYPE_DEFAULT].clothColor.r = 0x78;
mChildren[MENU_CLOTH_TYPE_DEFAULT].clothColor.g = 0xA5;
mChildren[MENU_CLOTH_TYPE_DEFAULT].clothColor.b = 0x37;
mChildren[MENU_CLOTH_TYPE_DEFAULT].clothColor.a = 0xDC;
// Dark green
mChildren[MENU_CLOTH_TYPE_DEFAULT].shadowColor.r = 0x23;
mChildren[MENU_CLOTH_TYPE_DEFAULT].shadowColor.g = 0x5F;
mChildren[MENU_CLOTH_TYPE_DEFAULT].shadowColor.b = 0x19;
mChildren[MENU_CLOTH_TYPE_DEFAULT].shadowColor.a = 0x20;
mChildren[MENU_CLOTH_TYPE_DEFAULT].startAlpha = 0;
mChildren[MENU_CLOTH_TYPE_DEFAULT].fadeInLength = 7;
mChildren[MENU_CLOTH_TYPE_DEFAULT].waveProgressStep = -1000;
mChildren[MENU_CLOTH_TYPE_DEFAULT].waveFreqX = 9000;
mChildren[MENU_CLOTH_TYPE_DEFAULT].waveFreqY = 0x800;
mChildren[MENU_CLOTH_TYPE_DEFAULT].waveAmpX = 5.0;
mChildren[MENU_CLOTH_TYPE_DEFAULT].waveAmpY = 5.0;
mChildren[MENU_CLOTH_TYPE_DEFAULT].waveAmpZ = 250.0;
mChildren[MENU_CLOTH_TYPE_DEFAULT].lightDistance = 1000.0;
mChildren[MENU_CLOTH_TYPE_DEFAULT].lightPitch = 0;
mChildren[MENU_CLOTH_TYPE_DEFAULT].lightYaw = 0;
mChildren[MENU_CLOTH_TYPE_DEFAULT].wavePreSteps = 2;
mChildren[MENU_CLOTH_TYPE_DEFAULT].maxStep = 290.0f;
}
// File Select
{
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].scale.set(1.27f, 0.93f, 1.0f);
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].rot.setall(0);
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].pos.set(350.0f, -15.0f, -2400.0f);
// Beige
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].clothColor.r = 0xBE;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].clothColor.g = 0xB4;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].clothColor.b = 0x64;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].clothColor.a = 0xAA;
// Dark brown
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].shadowColor.r = 0x8C;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].shadowColor.g = 0x50;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].shadowColor.b = 0x14;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].shadowColor.a = 0x20;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].startAlpha = 0;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].fadeInLength = 7;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].waveProgressStep = -1000;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].waveFreqX = 9000;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].waveFreqY = 0x800;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].waveAmpX = 5.0;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].waveAmpY = 5.0;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].waveAmpZ = 250.0;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].lightDistance = 1000.0;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].lightPitch = 0;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].lightYaw = 0;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].wavePreSteps = 2;
mChildren[MENU_CLOTH_TYPE_FILE_SELECT].maxStep = 290.0;
}
// Cloth Only
{
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].scale.set(1.7f, 1.7f, 1.0f);
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].rot.set(0, 0, 0x4000);
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].pos.set(360.0f, 40.0f, -2400.0f);
// Beige
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].clothColor.r = 0xBE;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].clothColor.g = 0xB4;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].clothColor.b = 0x64;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].clothColor.a = 0xDC;
// Dark brown
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].shadowColor.r = 0x8C;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].shadowColor.g = 0x50;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].shadowColor.b = 0x14;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].shadowColor.a = 0x20;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].startAlpha = 0;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].fadeInLength = 7;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].waveProgressStep = -1000;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].waveFreqX = 9000;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].waveFreqY = 0x800;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].waveAmpX = 5.0;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].waveAmpY = 5.0;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].waveAmpZ = 250.0;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].lightDistance = 1000.0;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].lightPitch = 0;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].lightYaw = 0;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].wavePreSteps = 2;
mChildren[MENU_CLOTH_TYPE_CLOTH_ONLY].maxStep = 290.0;
}
}
/* 8019966C-801996B4 .text __dt__18daCLOTH_ChildHIO_cFv */
daCLOTH_ChildHIO_c::~daCLOTH_ChildHIO_c() {
}
/* 801996B4-801996C4 .text __ct__18daCLOTH_ChildHIO_cFv */
daCLOTH_ChildHIO_c::daCLOTH_ChildHIO_c() {
}
/* 801996C4-8019977C .text lightSet1__9dMCloth_cF4cXyz */
void dMCloth_c::lightSet1(cXyz) {
GXLightObj light;
const f32 lightDistance = HIO_CHILD.lightDistance;
GXInitLightPos(
&light,
-lightDistance * cM_ssin(HIO_CHILD.lightYaw) * cM_scos(HIO_CHILD.lightPitch),
-lightDistance * cM_ssin(HIO_CHILD.lightPitch),
-lightDistance * cM_scos(HIO_CHILD.lightYaw) * cM_scos(HIO_CHILD.lightPitch)
);
GXInitLightColor(&light, (GXColor){0xFF, 0xFF, 0xFF, 0x00});
GXLoadLightObjImm(&light, GX_LIGHT0);
}
// This is to get the floats in the right order.
static void dummy0() {
vf32 a;
a = 0.0f;
a = 90.0f;
}
/* 8019977C-80199CD0 .text cloth_init__9dMCloth_cFv */
void dMCloth_c::cloth_init() {
cXyz* pPosArr = getPos();
cXyz* pNrm = getNrm();
cXyz* pOffArr = getOffsetVec();
for (int y = 0; y < INNER_SIZE; y++) {
int x = 0;
s16 yAngle = -y * 3500;
for (; x < INNER_SIZE; x++) {
pPosArr[x + y * INNER_SIZE].x = cM_ssin(x * 3276.8f) * 954.9299f + -1500.0f + x * 10.0f * cM_ssin(yAngle);
pPosArr[x + y * INNER_SIZE].y = y * 300.0f + -1500.0f;
pPosArr[x + y * INNER_SIZE].z = (1.0f - cM_scos(x * 3276.8f)) * 716.1974f + -3400.0f + x * -5.0f * cM_scos(yAngle);
pOffArr[x + y * INNER_SIZE].set(cM_scos(x * 3276.8f - 1000.0f) * -320.0f, 0.0f, cM_ssin(x * 3276.8f - 1000.0f) * -270.0f);
}
}
for (int y = 0; y < INNER_SIZE; y++) {
for (int x = 0; x < INNER_SIZE; x++) {
setNrmVtx(pNrm, x, y);
pNrm++;
}
}
setBackNrm();
mWaveProgress = 0;
mFadeInCounter = 0;
cloth_move();
mAlphaOut = 0;
mCurrentAlpha = HIO_CHILD.clothColor.a;
mWaveProgress += HIO_CHILD.waveProgressStep;
DCStoreRangeNoSync(mPosArr[mCurArr], INNER_SIZE * INNER_SIZE * sizeof(cXyz));
DCStoreRangeNoSync(mNrmArr[mCurArr], INNER_SIZE * INNER_SIZE * sizeof(cXyz));
#if VERSION > VERSION_JPN
DCStoreRangeNoSync(mBackNrmArr, INNER_SIZE * INNER_SIZE * sizeof(cXyz));
#endif
mClothColor.r = (u8)HIO_CHILD.clothColor.r;
mClothColor.g = (u8)HIO_CHILD.clothColor.g;
mClothColor.b = (u8)HIO_CHILD.clothColor.b;
mClothColor.a = (u8)HIO_CHILD.clothColor.a;
mShadowColor.r = (u8)HIO_CHILD.shadowColor.r;
mShadowColor.g = (u8)HIO_CHILD.shadowColor.g;
mShadowColor.b = (u8)HIO_CHILD.shadowColor.b;
mShadowColor.a = (u8)HIO_CHILD.shadowColor.a;
switch (mClothType) {
case MENU_CLOTH_TYPE_DEFAULT: {
init_angle_z += cM_deg2s(cM_rndFX(45.0f) + 90.0f);
#if VERSION > VERSION_JPN
mScale = HIO_CHILD.scale;
#else
mScale.set(1.75f, 1.75f, 1.0f);
#endif
mRot.set(0, 0, init_angle_z);
s32 n = HIO_CHILD.wavePreSteps;
while (n--) {
cloth_move_sin();
}
} break;
case MENU_CLOTH_TYPE_FILE_SELECT: {
mScale.set(1.27f, 0.93f, 1.0f);
mRot.setall(0);
} break;
case MENU_CLOTH_TYPE_CLOTH_ONLY: {
mScale = HIO_CHILD.scale;
mRot = HIO_CHILD.rot;
mRot.z += cM_deg2s(cM_rndFX(20.0f));
s32 n = HIO_CHILD.wavePreSteps;
while (n--) {
cloth_move_sin();
}
} break;
}
}
// This is to get the floats in the right order.
static void dummy1() {
vf32 a = 305.0f;
}
/* 80199CD0-80199E1C .text init__9dMCloth_cFv */
void dMCloth_c::init() {
cloth_init();
ResTIMG* image = (ResTIMG*)JKRArchive::getGlbResource('TIMG', "cloth_piece01.bti", mpArc);
JUT_ASSERT(VERSION_SELECT(528, 526, 530, 530), image != NULL);
#if VERSION == VERSION_DEMO
BOOL mipmap = image->mipmapCount > 1;
#endif
GXInitTexObj(
&mTexObj,
(u8*)image + image->imageOffset,
image->width,
image->height,
GXTexFmt(image->format),
GXTexWrapMode(image->wrapS),
GXTexWrapMode(image->wrapT),
#if VERSION == VERSION_DEMO
mipmap
#else
image->mipmapCount > 1
#endif
);
GXInitTexObjLOD(
&mTexObj,
GXTexFilter(image->minFilter),
GXTexFilter(image->magFilter),
image->minLOD * 0.125f,
image->maxLOD * 0.125f,
image->LODBias * 0.01f,
image->biasClamp,
image->doEdgeLOD,
GXAnisotropy(image->maxAnisotropy)
);
}
/* 80199E1C-80199F48 .text __ct__9dMCloth_cFv */
dMCloth_c::dMCloth_c() {
mCurArr = 0;
unused_0x4 = 0;
mClothType = MENU_CLOTH_TYPE_DEFAULT;
if (l_HIO.mNo < 0) {
l_HIO.mNo = mDoHIO_createChild("メニューの布", &l_HIO); // Menu cloth
}
}
/* 80199F48-8019A058 .text __dt__9dMCloth_cFv */
dMCloth_c::~dMCloth_c() {
if (l_HIO.mNo >= 0) {
mDoHIO_deleteChild(l_HIO.mNo);
l_HIO.mNo = -1;
}
mpArc->removeResourceAll();
}
/* 8019A058-8019A0AC .text setBackNrm__9dMCloth_cFv */
void dMCloth_c::setBackNrm() {
cXyz* pNrm = getNrm();
cXyz* pBackNrm = getBackNrm();
for (int i = 0; i < ARR_SIZE; i++) {
pBackNrm->set(-pNrm->x, -pNrm->y, -pNrm->z);
pNrm++;
pBackNrm++;
}
}
/* 8019A0AC-8019A480 .text setNrmVtx__9dMCloth_cFP4cXyzii */
void dMCloth_c::setNrmVtx(cXyz* pDst, int x, int y) {
cXyz x_diff;
cXyz y_diff;
cXyz norm;
cXyz total;
cXyz pos;
cXyz* pPos = getPos();
pos = pPos[(x + y * INNER_SIZE)];
total.setall(0.0f);
if (x != 0) {
x_diff = pPos[x - 1 + y * INNER_SIZE] - pos;
if (y != 0) {
y_diff = pPos[x + (y - 1) * INNER_SIZE] - pos;
norm = x_diff.outprod(y_diff);
norm = norm.normZP();
total += norm;
}
if (y != INNER_SIZE - 1) {
y_diff = pPos[x + (y + 1) * INNER_SIZE] - pos;
norm = y_diff.outprod(x_diff);
norm = norm.normZP();
total += norm;
}
}
if (x != INNER_SIZE - 1) {
x_diff = pPos[x + 1 + y * INNER_SIZE] - pos;
if (y != 0) {
y_diff = pPos[x + (y - 1) * INNER_SIZE] - pos;
norm = y_diff.outprod(x_diff);
norm = norm.normZP();
total += norm;
}
if (y != INNER_SIZE - 1) {
y_diff = pPos[x + (y + 1) * INNER_SIZE] - pos;
norm = x_diff.outprod(y_diff);
norm = norm.normZP();
total += norm;
}
}
MtxPush();
mDoMtx_YrotM(*calc_mtx, cM_ssin(x * -800) * 900.0f);
MtxPosition(&total, pDst);
if (!pDst->normalizeRS()) {
pDst->set(0.0f, 0.0f, 1.0f);
}
MtxPull();
}
/* 8019A480-8019A65C .text plot__9dMCloth_cFffff */
void dMCloth_c::plot(float xMin, float yMin, float xMax, float yMax) {
f32 xPos = 0.0f;
const f32 xStep = (xMax - xMin) * (1.0f / (f32)(INNER_SIZE - 1));
const f32 yStep = (yMax - yMin) * (1.0f / (f32)(INNER_SIZE - 1));
for (int xNext = 1, x = 0; x < INNER_SIZE - 1; x++, xNext++) {
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, INNER_SIZE * 2);
f32 yPos = yMax;
for (int y = 0; y < INNER_SIZE; y++) {
switch (mClothType) {
case MENU_CLOTH_TYPE_DEFAULT:
case MENU_CLOTH_TYPE_CLOTH_ONLY: {
// Vertex 1
{
GXPosition1x16(x + y * INNER_SIZE);
GXNormal1x16(x + y * INNER_SIZE);
GXTexCoord2f32(xPos, yPos);
}
// Vertex 2
{
GXPosition1x16(xNext + y * INNER_SIZE);
GXNormal1x16(xNext + y * INNER_SIZE);
GXTexCoord2f32(xPos + xStep, yPos);
}
} break;
case MENU_CLOTH_TYPE_FILE_SELECT: {
u8 alpha0, alpha1;
{
const int fromRight = 10 - x;
const int fromRightNext = 10 - xNext;
const int fromBottomRight = fromRight + y;
const int fromBottomRightNext = fromRightNext + y;
alpha0 = cLib_maxLimit(fromBottomRight * 25, 0xFF);
alpha1 = cLib_maxLimit(fromBottomRightNext * 25, 0xFF);
}
// Vertex 1
{
GXPosition1x16(x + y * INNER_SIZE);
GXNormal1x16(x + y * INNER_SIZE);
#if VERSION == VERSION_DEMO
const u8 b = mClothColor.b;
const u8 g = mClothColor.g;
const u8 r = mClothColor.r;
#else
const u8 r = mClothColor.r;
const u8 b = mClothColor.b;
const u8 g = mClothColor.g;
#endif
GXColor4x8(r, g, b, alpha0);
GXTexCoord2f32(xPos, yPos);
}
// Vertex 2
{
GXPosition1x16(xNext + y * INNER_SIZE);
GXNormal1x16(xNext + y * INNER_SIZE);
#if VERSION == VERSION_DEMO
const u8 b = mClothColor.b;
const u8 g = mClothColor.g;
const u8 r = mClothColor.r;
#else
const u8 r = mClothColor.r;
const u8 b = mClothColor.b;
const u8 g = mClothColor.g;
#endif
GXColor4x8(r, g, b, alpha1);
GXTexCoord2f32(xPos + xStep, yPos);
}
} break;
}
yPos -= yStep;
}
xPos += xStep;
}
}
/* 8019A65C-8019A838 .text plot_shadow__9dMCloth_cFffff */
void dMCloth_c::plot_shadow(float xMin, float yMin, float xMax, float yMax) {
f32 xPos = 0.0f;
const f32 xStep = (xMax - xMin) * (1.0f / (f32)(INNER_SIZE - 1));
const f32 yStep = (yMax - yMin) * (1.0f / (f32)(INNER_SIZE - 1));
for (int xNext = 1, x = 0; x < INNER_SIZE - 1; x++, xNext++) {
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, INNER_SIZE * 2);
f32 yPos = yMax;
for (int y = 0; y < INNER_SIZE; y++) {
switch (mClothType) {
case MENU_CLOTH_TYPE_DEFAULT:
case MENU_CLOTH_TYPE_CLOTH_ONLY: {
// Vertex 1
{
GXPosition1x16(x + y * INNER_SIZE);
GXNormal1x16(x + y * INNER_SIZE);
GXTexCoord2f32(xPos, yPos);
}
// Vertex 2
{
GXPosition1x16(xNext + y * INNER_SIZE);
GXNormal1x16(xNext + y * INNER_SIZE);
GXTexCoord2f32(xPos + xStep, yPos);
}
} break;
case MENU_CLOTH_TYPE_FILE_SELECT: {
u8 alpha0, alpha1;
{
const int fromRight = 10 - x;
const int fromRightNext = 10 - xNext;
const int fromBottomRight = fromRight + y;
const int fromBottomRightNext = fromRightNext + y;
alpha0 = cLib_maxLimit(fromBottomRight * 25, 0xFF);
alpha1 = cLib_maxLimit(fromBottomRightNext * 25, 0xFF);
}
// Vertex 1
{
GXPosition1x16(x + y * INNER_SIZE);
GXNormal1x16(x + y * INNER_SIZE);
#if VERSION == VERSION_DEMO
const u8 b = mShadowColor.b;
const u8 g = mShadowColor.g;
const u8 r = mShadowColor.r;
#else
const u8 r = mShadowColor.r;
const u8 b = mShadowColor.b;
const u8 g = mShadowColor.g;
#endif
GXColor4x8(r, g, b, alpha0);
GXTexCoord2f32(xPos, yPos);
}
// Vertex 2
{
GXPosition1x16(xNext + y * INNER_SIZE);
GXNormal1x16(xNext + y * INNER_SIZE);
#if VERSION == VERSION_DEMO
const u8 b = mShadowColor.b;
const u8 g = mShadowColor.g;
const u8 r = mShadowColor.r;
#else
const u8 r = mShadowColor.r;
const u8 b = mShadowColor.b;
const u8 g = mShadowColor.g;
#endif
GXColor4x8(r, g, b, alpha1);
GXTexCoord2f32(xPos + xStep, yPos);
}
} break;
}
yPos -= yStep;
}
xPos += xStep;
}
}
/* 8019A838-8019A844 .text alpha_out__9dMCloth_cFv */
void dMCloth_c::alpha_out() {
mAlphaOut = 1;
}
/* 8019A844-8019A9C4 .text TevSettingMenu__9dMCloth_cFv */
void dMCloth_c::TevSettingMenu() {
GXSetChanCtrl(GX_COLOR0, true, GX_SRC_REG, GX_SRC_REG, 1, GX_DF_CLAMP, GX_AF_NONE);
GXSetNumTexGens(1);
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
GXSetNumTevStages(2);
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP1, GX_TEV_SWAP0);
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C1, GX_CC_C0, GX_CC_TEXC, GX_CC_ZERO);
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
GXSetTevSwapMode(GX_TEVSTAGE1, GX_TEV_SWAP0, GX_TEV_SWAP0);
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_CPREV);
GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
}
/* 8019A9C4-8019AB64 .text TevSettingFileSelect__9dMCloth_cFv */
void dMCloth_c::TevSettingFileSelect() {
GXSetChanCtrl(GX_COLOR0, true, GX_SRC_REG, GX_SRC_REG, 1, GX_DF_CLAMP, GX_AF_NONE);
GXSetChanCtrl(GX_ALPHA0, false, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_CLAMP, GX_AF_NONE);
GXSetNumTexGens(1);
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
GXSetNumTevStages(2);
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP1, GX_TEV_SWAP0);
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C1, GX_CC_C0, GX_CC_TEXC, GX_CC_ZERO);
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_A0, GX_CA_RASA, GX_CA_ZERO);
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
GXSetTevSwapMode(GX_TEVSTAGE1, GX_TEV_SWAP0, GX_TEV_SWAP0);
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_CPREV);
GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV);
GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
}
/* 8019AB64-8019ABB4 .text TevSetting__9dMCloth_cFv */
void dMCloth_c::TevSetting() {
switch (mClothType) {
case MENU_CLOTH_TYPE_DEFAULT:
case MENU_CLOTH_TYPE_CLOTH_ONLY:
TevSettingMenu();
break;
case MENU_CLOTH_TYPE_FILE_SELECT:
TevSettingFileSelect();
break;
}
}
/* 8019ABB4-8019AC8C .text ShadowTevSettingMenu__9dMCloth_cFv */
void dMCloth_c::ShadowTevSettingMenu() {
GXSetChanCtrl(GX_COLOR0, true, GX_SRC_REG, GX_SRC_REG, 1, GX_DF_CLAMP, GX_AF_NONE);
GXSetNumTexGens(1);
GXSetNumTevStages(1);
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP1, GX_TEV_SWAP0);
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO);
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A1);
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
}
/* 8019AC8C-8019AD84 .text ShadowTevSettingFileSelect__9dMCloth_cFv */
void dMCloth_c::ShadowTevSettingFileSelect() {
GXSetChanCtrl(GX_COLOR0, true, GX_SRC_REG, GX_SRC_REG, 1, GX_DF_CLAMP, GX_AF_NONE);
GXSetChanCtrl(GX_ALPHA0, false, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_CLAMP, GX_AF_NONE);
GXSetNumTexGens(1);
GXSetNumTevStages(1);
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP1, GX_TEV_SWAP0);
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO);
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_A1, GX_CA_RASA, GX_CA_ZERO);
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
}
/* 8019AD84-8019ADD4 .text ShadowTevSetting__9dMCloth_cFv */
void dMCloth_c::ShadowTevSetting() {
switch (mClothType) {
case MENU_CLOTH_TYPE_DEFAULT:
case MENU_CLOTH_TYPE_CLOTH_ONLY:
ShadowTevSettingMenu();
break;
case MENU_CLOTH_TYPE_FILE_SELECT:
ShadowTevSettingFileSelect();
break;
}
}
/* 8019ADD4-8019B670 .text draw__9dMCloth_cFf8_GXColor8_GXColorUc */
void dMCloth_c::draw(float, GXColor clothColor, GXColor shadowColor, unsigned char) {
cXyz* pPos = getPos();
cXyz* pPos2 = mShadowPosArr;
for (int y = 0; y < INNER_SIZE; y++) {
for (int x = 0; x < INNER_SIZE; x++) {
*pPos2 = *pPos;
pPos2->z = -3300.0f;
pPos2++;
pPos++;
}
}
DCStoreRangeNoSync(mShadowPosArr, INNER_SIZE * INNER_SIZE * sizeof(cXyz));
clothColor = mClothColor;
shadowColor = mShadowColor;
if (mAlphaOut == 1) {
// Fade out alpha.
clothColor.a = mCurrentAlpha;
if (mCurrentAlpha > 25) {
mCurrentAlpha -= 25;
} else {
mCurrentAlpha = 0;
}
} else {
// Interpolate from startAlpha to final alpha.
f32 f = (f32)mFadeInCounter / HIO_CHILD.fadeInLength;
{
clothColor.a = cLib_minMaxLimit<s16>(HIO_CHILD.clothColor.a, 0, 0xFF);
clothColor.a = clothColor.a * f + (1.0f - f) * HIO_CHILD.startAlpha;
}
{
shadowColor.a = cLib_minMaxLimit<s16>(HIO_CHILD.shadowColor.a, 0, 0xFF);
shadowColor.a = shadowColor.a * f + (1.0f - f) * HIO_CHILD.startAlpha;
}
}
j3dSys.reinitGX();
#if VERSION > VERSION_JPN
GXSetNumIndStages(0);
#endif
cXyz lightPos;
lightPos.set(0.0f, 0.0f, 0.0f);
switch (mClothType) {
case MENU_CLOTH_TYPE_DEFAULT:
case MENU_CLOTH_TYPE_CLOTH_ONLY: {
GXClearVtxDesc();
GXSetVtxDesc(GX_VA_POS, GX_INDEX16);
GXSetVtxDesc(GX_VA_NRM, GX_INDEX16);
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
GXSetChanAmbColor(GX_COLOR0, (GXColor){0x00, 0x00, 0x00, 0x00});
GXSetChanMatColor(GX_COLOR0, (GXColor){0xFF, 0xFF, 0xFF, 0xFF});
} break;
case MENU_CLOTH_TYPE_FILE_SELECT: {
GXClearVtxDesc();
GXSetVtxDesc(GX_VA_POS, GX_INDEX16);
GXSetVtxDesc(GX_VA_NRM, GX_INDEX16);
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
GXSetChanAmbColor(GX_COLOR0, (GXColor){0x00, 0x00, 0x00, 0xFF});
GXSetChanMatColor(GX_COLOR0, (GXColor){0xFF, 0xFF, 0xFF, 0xFF});
} break;
}
GXSetTevColor(GX_TEVREG0, clothColor);
GXSetTevColor(GX_TEVREG1, shadowColor);
GXTexObj tex_obj;
ResTIMG* i_toonimage = dDlst_list_c::getToonImage();
GXInitTexObj(
&tex_obj,
(u8*)i_toonimage + i_toonimage->imageOffset,
i_toonimage->width,
i_toonimage->height,
(GXTexFmt)i_toonimage->format,
(GXTexWrapMode)i_toonimage->wrapS,
(GXTexWrapMode)i_toonimage->wrapT,
i_toonimage->mipmapCount > 1
);
GXInitTexObjLOD(
&tex_obj,
(GXTexFilter)i_toonimage->minFilter,
(GXTexFilter)i_toonimage->magFilter,
i_toonimage->minLOD * 0.125f,
i_toonimage->maxLOD * 0.125f,
i_toonimage->LODBias * 0.01f,
i_toonimage->biasClamp,
i_toonimage->doEdgeLOD,
(GXAnisotropy)i_toonimage->maxAnisotropy
);
GXLoadTexObj(&mTexObj, GX_TEXMAP0);
GXLoadTexObj(&tex_obj, GX_TEXMAP1);
GXSetNumChans(1);
GXCallDisplayList(l_matDL, 0x20);
lightSet1(lightPos);
switch (mClothType) {
case MENU_CLOTH_TYPE_FILE_SELECT:
case MENU_CLOTH_TYPE_CLOTH_ONLY: {
mDoMtx_stack_c::transS(HIO_CHILD.pos.x + -275.0f, HIO_CHILD.pos.y - 75.0f, HIO_CHILD.pos.z + -3800.0f);
mDoMtx_stack_c::XrotM(mRot.x);
mDoMtx_stack_c::YrotM(mRot.y);
mDoMtx_stack_c::ZrotM(mRot.z);
mDoMtx_stack_c::scaleM(mScale);
mDoMtx_stack_c::transM(0.0f, 0.0f, 3400.0f);
GXLoadPosMtxImm(mDoMtx_stack_c::get(), GX_PNMTX0);
GXLoadNrmMtxImm(mDoMtx_stack_c::get(), GX_PNMTX0);
GXSetCullMode(GX_CULL_FRONT);
GXSetCurrentMtx(GX_PNMTX0);
GXSetArray(GX_VA_POS, getPos(), sizeof(cXyz));
GXSetArray(GX_VA_NRM, getNrm(), sizeof(cXyz));
ShadowTevSetting();
plot(0.0f, 0.0f, 10.0f, 10.0f);
} break;
}
mDoMtx_stack_c::transS(HIO_CHILD.pos.x + -350.0f, HIO_CHILD.pos.y, HIO_CHILD.pos.z + -3800.0f);
mDoMtx_stack_c::XrotM(mRot.x);
mDoMtx_stack_c::YrotM(mRot.y);
mDoMtx_stack_c::ZrotM(mRot.z);
mDoMtx_stack_c::scaleM(mScale);
mDoMtx_stack_c::transM(0.0f, 0.0f, 3400.0f);
GXLoadPosMtxImm(mDoMtx_stack_c::get(), GX_PNMTX0);
GXLoadNrmMtxImm(mDoMtx_stack_c::get(), GX_PNMTX0);
GXSetCullMode(GX_CULL_FRONT);
GXSetCurrentMtx(GX_PNMTX0);
GXSetArray(GX_VA_POS, getPos(), sizeof(cXyz));
GXSetArray(GX_VA_NRM, getNrm(), sizeof(cXyz));
TevSetting();
plot(0.0f, 0.0f, 10.0f, 10.0f);
GXSetCullMode(GX_CULL_BACK);
ShadowTevSetting();
GXSetArray(GX_VA_POS, mShadowPosArr, sizeof(cXyz));
plot_shadow(0.0f, 0.0f, 1.0f, 1.0f);
TevSetting();
GXSetArray(GX_VA_POS, getPos(), sizeof(cXyz));
GXSetArray(GX_VA_NRM, getBackNrm(), sizeof(cXyz));
plot(0.0f, 0.0f, 10.0f, 10.0f);
j3dSys.reinitGX();
}
// This is to get the floats in the right order.
static void dummy2() {
vf32 a = 0.5f;
}
/* 8019B670-8019B9C0 .text cloth_move_sin__9dMCloth_cFv */
void dMCloth_c::cloth_move_sin() {
mWaveProgress += HIO_CHILD.waveProgressStep;
cXyz* pPosArr = getPos();
for (int y = 0; y < INNER_SIZE; y++) {
for (int x = 0; x < INNER_SIZE; x++) {
f32 fx = (f32)x;
f32 fy = (f32)y;
if (x > INNER_SIZE / 2) {
fx = (INNER_SIZE - fx) - 1.0f;
}
if (y > INNER_SIZE / 2) {
fy = (INNER_SIZE - fy) - 1.0f;
}
if (fx + fy > 4.0f) {
fx = 1.0f;
} else {
fx = (fx + fy) * 0.2f;
}
cXyz pos;
pos.x = -1500.0f + 305.0f * (f32)x;
pos.y = -1500.0f + 300.0f * (f32)y;
pos.z = -3400.0f;
pos.x += HIO_CHILD.waveAmpX * fx * cM_ssin(mWaveProgress + x * HIO_CHILD.waveFreqX + y * HIO_CHILD.waveFreqY);
pos.y += HIO_CHILD.waveAmpY * fx * cM_scos(mWaveProgress + x * HIO_CHILD.waveFreqX + y * HIO_CHILD.waveFreqY);
pos.z += HIO_CHILD.waveAmpZ * fx * cM_ssin(mWaveProgress + x * HIO_CHILD.waveFreqX);
cLib_addCalcPos2(&pPosArr[x + y * INNER_SIZE], pos, 0.5f, HIO_CHILD.maxStep);
}
}
cXyz* pNrm = getNrm();
for (int y = 0; y < INNER_SIZE; y++) {
for (int x = 0; x < INNER_SIZE; x++) {
setNrmVtx(pNrm, x, y);
pNrm++;
}
}
setBackNrm();
DCStoreRangeNoSync(getPos(), INNER_SIZE * INNER_SIZE * sizeof(cXyz));
DCStoreRangeNoSync(getNrm(), INNER_SIZE * INNER_SIZE * sizeof(cXyz));
DCStoreRangeNoSync(getBackNrm(), INNER_SIZE * INNER_SIZE * sizeof(cXyz));
}
/* 8019B9C0-8019BCF4 .text cloth_move_simple__9dMCloth_cFv */
void dMCloth_c::cloth_move_simple() {
cXyz* pPosArr = getPos();
for (int y = 0; y < INNER_SIZE; y++) {
for (int x = 0; x < INNER_SIZE; x++) {
f32 fx = (f32)x;
f32 fy = (f32)y;
if (x > INNER_SIZE / 2) {
fx = (INNER_SIZE - fx) - 1.0f;
}
if (y > INNER_SIZE / 2) {
fy = (INNER_SIZE - fy) - 1.0f;
}
if (fx + fy > 4.0f) {
fx = 1.0f;
} else {
fx = (fx + fy) * 0.2f;
}
cXyz pos;
pos.x = -1500.0f + 305.0f * (f32)x;
pos.y = -1500.0f + 300.0f * (f32)y;
pos.z = -3400.0f;
pos.x += HIO_CHILD.waveAmpX * fx * cM_ssin(mWaveProgress + x * HIO_CHILD.waveFreqX + y * HIO_CHILD.waveFreqY);
pos.y += HIO_CHILD.waveAmpY * fx * cM_scos(mWaveProgress + x * HIO_CHILD.waveFreqX + y * HIO_CHILD.waveFreqY);
pos.z += HIO_CHILD.waveAmpZ * fx * cM_ssin(mWaveProgress + y * HIO_CHILD.waveFreqY);
cLib_addCalcPos2(&pPosArr[x + y * INNER_SIZE], pos, 0.5f, HIO_CHILD.maxStep);
}
}
cXyz* pNrm = getNrm();
for (int y = 0; y < INNER_SIZE; y++) {
for (int x = 0; x < INNER_SIZE; x++) {
setNrmVtx(pNrm, x, y);
pNrm++;
}
}
setBackNrm();
DCStoreRangeNoSync(getPos(), INNER_SIZE * INNER_SIZE * sizeof(cXyz));
DCStoreRangeNoSync(getNrm(), INNER_SIZE * INNER_SIZE * sizeof(cXyz));
DCStoreRangeNoSync(getBackNrm(), INNER_SIZE * INNER_SIZE * sizeof(cXyz));
}
/* 8019BCF4-8019BDB8 .text cloth_move__9dMCloth_cFv */
void dMCloth_c::cloth_move() {
switch (mClothType) {
case MENU_CLOTH_TYPE_DEFAULT:
case MENU_CLOTH_TYPE_CLOTH_ONLY: {
if (mFadeInCounter < HIO_CHILD.fadeInLength) {
cloth_move_sin();
mFadeInCounter++;
} else {
cloth_move_simple();
}
} break;
case MENU_CLOTH_TYPE_FILE_SELECT: {
if (mFadeInCounter < HIO_CHILD.fadeInLength) {
mFadeInCounter++;
}
cloth_move_sin();
} break;
}
}
/* 8019BDB8-8019BDC0 .text dMenu_ClothCreate__FPv */
static cPhs_State dMenu_ClothCreate(void*) {
return cPhs_COMPLEATE_e;
}
/* 8019BDC0-8019BDC8 .text dMenu_ClothDelete__FPv */
static BOOL dMenu_ClothDelete(void*) {
return TRUE;
}
/* 8019BDC8-8019BDD0 .text dMenu_ClothExecute__FPv */
static BOOL dMenu_ClothExecute(void*) {
return FALSE;
}
/* 8019BDD0-8019BDD8 .text dMenu_ClothDraw__FPv */
static BOOL dMenu_ClothDraw(void*) {
return TRUE;
}
/* 8019BDD8-8019BDE0 .text dMenu_ClothIsDelete__FPv */
static BOOL dMenu_ClothIsDelete(void*) {
return TRUE;
}
class menu_cloth_class : public msg_class {
/* 0x00FC */ dMCloth_c mCloth;
/* 0x9264 */ u8 padding[0x929C - 0x9264];
};
STATIC_ASSERT(sizeof(menu_cloth_class) == 0x929C);
// BUG: The functions in this table are out of order.
// It doesn't really matter, because they're just empty functions.
static msg_method_class dMenu_ClothMethodTable = {
/* Create */ (process_method_func)dMenu_ClothCreate,
/* Delete */ (process_method_func)dMenu_ClothDelete,
/* Execute */ (process_method_func)dMenu_ClothDraw,
/* IsDelete */ (process_method_func)dMenu_ClothExecute,
/* Draw */ (process_method_func)dMenu_ClothIsDelete,
};
msg_process_profile_definition g_profile_Menu_Cloth = {
/* LayerID */ (uint)fpcLy_CURRENT_e,
/* ListID */ 0x000C,
/* ListPrio */ fpcPi_CURRENT_e,
/* ProcName */ PROC_Menu_Cloth,
/* Proc SubMtd */ &g_fpcLf_Method.base,
/* Size */ sizeof(menu_cloth_class),
/* SizeOther */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopMsg_Method,
/* Priority */ PRIO_Menu_Cloth,
/* Msg SubMtd */ &dMenu_ClothMethodTable,
};