diff options
| author | Treeki <treeki@gmail.com> | 2013-01-17 09:23:55 +0100 | 
|---|---|---|
| committer | Treeki <treeki@gmail.com> | 2013-01-17 09:23:55 +0100 | 
| commit | 1e2fe2181af8215e6da3f55d0350385d0af2f7e0 (patch) | |
| tree | 697f2105ceedd031f901c896d2747ccdfc2b43bb | |
| parent | 4a51200b922d2ed0896562d95d1d9e390a014db3 (diff) | |
| download | kamek-1e2fe2181af8215e6da3f55d0350385d0af2f7e0.tar.gz kamek-1e2fe2181af8215e6da3f55d0350385d0af2f7e0.zip  | |
myriad updates and fixes to EVERYTHING
Diffstat (limited to '')
| -rwxr-xr-x | include/game.h | 72 | ||||
| -rw-r--r-- | kamek_pal.x | 16 | ||||
| -rw-r--r-- | poweruphax.yaml | 200 | ||||
| -rw-r--r-- | src/koopatlas/core.cpp | 42 | ||||
| -rw-r--r-- | src/koopatlas/core.h | 4 | ||||
| -rw-r--r-- | src/koopatlas/hud.cpp | 27 | ||||
| -rw-r--r-- | src/koopatlas/hud.h | 3 | ||||
| -rw-r--r-- | src/koopatlas/pathmanager.cpp | 1 | ||||
| -rw-r--r-- | src/koopatlas/shop.cpp | 70 | ||||
| -rw-r--r-- | src/koopatlas/shop.h | 4 | ||||
| -rw-r--r-- | src/poweruphax.S | 373 | ||||
| -rw-r--r-- | src/poweruphax.cpp | 78 | 
12 files changed, 828 insertions, 62 deletions
diff --git a/include/game.h b/include/game.h index 3a24aba..2a30ee7 100755 --- a/include/game.h +++ b/include/game.h @@ -3588,5 +3588,77 @@ namespace nw4r {  extern float EnemyBounceValue;
 +class dStockItemShadow_c : public dBase_c {
 +	public:
 +	m2d::EmbedLayout_c layout;
 +
 +	nw4r::lyt::Pane *rootPane;
 +	nw4r::lyt::TextBox *textBoxes[14];
 +	nw4r::lyt::Picture *buttonBases[7];
 +	bool layoutLoaded, visible, needsUpdate;
 +	int values[8];
 +	nw4r::lyt::TextBox *hammerValue, *hammerX;
 +	nw4r::lyt::Picture *hammerButtonBase;
 +};
 +
 +class dStockItem_c : public dBase_c {
 +	public:
 +	int onCreate();
 +	int onDelete();
 +	int beforeExecute();
 +	int onExecute();
 +	int onDraw();
 +
 +	dStockItem_c();
 +	~dStockItem_c();
 +
 +
 +	u32 _70;
 +	m2d::EmbedLayout_c layout;
 +	dStateWrapper_c<dStockItem_c> state;
 +
 +	nw4r::lyt::Pane
 +		*rootPane,
 +		*N_forUse_PPos[4],
 +		*N_icon[7],
 +		*N_stockItem, *N_stockItem_01,
 +		*N_itemSelect_00;
 +
 +	nw4r::lyt::Picture
 +		*P_icon[7],
 +		*P_buttonBase[7],
 +		*P_iconBase[10];
 +
 +	/*da2DPlayer_c*/void *player2d[4];
 +	/*daWMItem_c*/void *itemPtr[7];
 +	dStockItemShadow_c *shadow;
 +	int actionTaken;
 +	u32 _318, _31C, _320, _324;
 +	int usedItem;
 +	EGG::Effect effectArray[4], oneEffect;
 +	int effectIDs[4];
 +	int selectedItem, previousItem;
 +	u32 _8A8, _8AC;
 +	int playerCount, counts[7];
 +	u32 _8D0;
 +	int someAnimID;
 +	bool isPlayerActive[4], layoutLoaded, show, _8DE;
 +
 +	/*daWMItem_c*/void *newItemPtr[8];
 +	int newCounts[8];
 +	nw4r::lyt::Picture *newButtonBase[8];
 +	nw4r::lyt::Pane *newIconPanes[8];
 +	nw4r::lyt::Picture *newIconPictures[8];
 +
 +	void setScalesOfSomeThings();
 +	int getIconPictureIDforPlayer(int i);
 +};
 +
 +
 +// Some ugly code
 +extern void *SelectCursorPointer;
 +extern "C" void UpdateSelectCursor(nw4r::lyt::Pane *pane, int whichOne, bool unkBool);
 +extern "C" void HideSelectCursor(void *scPtr, int whichOne);
 +
  #endif
 diff --git a/kamek_pal.x b/kamek_pal.x index b2f1c5f..00904eb 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1,4 +1,20 @@  SECTIONS { +	UpdateSelectCursor = 0x800B44D0; +	HideSelectCursor = 0x8010C890; +	SelectCursorPointer = 0x8042A5A8; + +	getIconPictureIDforPlayer__12dStockItem_cFi = 0x807AFB90; +	CrapUpPositions__FP7Point3dPC7Point3d = 0x800B32E0; + +	ContinueFromCalcPowerupResult = 0x800FCA24; +	ContinueFromSILayoutExtraStuffs = 0x807AF9A8; +	ContinueFromResetHammerAnimOnOpen = 0x807B0B3C; +	ContinueFromHideItemsByDefault = 0x807AF840; +	MakeSFISound = 0x807B0844; +	ContinueFromSIAddSound = 0x807B08A0; +	ChosenStartChoice = 0x807B0D04; +	ContinueFromSISLayoutExtraStuffs = 0x807B2260; +	ContinueFromUpdateSIS = 0x807B2528;  	EnemyBounceValue = 0x8042A5F0; diff --git a/poweruphax.yaml b/poweruphax.yaml index da814db..7d88437 100644 --- a/poweruphax.yaml +++ b/poweruphax.yaml @@ -754,3 +754,203 @@ hooks:      addr_pal: 0x80A942EC      data: '28000005' + + +# STOCK ITEM BULLSHIT +# Current size: 0x8E0 +# New size: ? +# New fields: +# - 0x8E0 : Item Pointers +# - 0x900 : Item Counts +# - 0x920 : Button Bases +# - 0x940 : Icon Panes +# - 0x960 : Icon Pictures +# New anims: +# - 0x1E : On Hammer +# - 0x1F : Hit Hammer +# - 0x20 : Off Hammer +# +# todo: +# update loadlayout method +# stock item shadow +# wm_item + +  - name: ExpandStockItemStruct +    type: patch +    addr_pal: 0x807AF378 +    data: '38600980' + +  - name: SILayoutGroupParams +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807AF94C +    target_func: 'SILayoutGroupParams' + +  - name: SILayoutExtraStuffs +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x807AF9A4 +    target_func: 'SILayoutExtraStuffs' + +  - name: DisableUselessPowerupIDRedirection +    type: nop_insn +    area_pal: [0x807af790, 0x807af794] + +  - name: GetCountsFor8Powerups +    type: patch +    addr_pal: 0x807AF7A8 +    data: '2C1C0008 901E 0900' + +  - name: HideItemsByDefault +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x807AF7B8 +    target_func: 'HideItemsByDefault' + +  - {name: FixAnimID30, type: patch, addr_pal: 0x807AFB08, data: '2C04 0020'} +  - {name: FixAnimID30, type: patch, addr_pal: 0x807AFB20, data: '3800 0020'} +  - {name: FixAnimID30, type: patch, addr_pal: 0x807B0994, data: '3800 0020'} + +  - name: NewSetScalesThingy +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x807AFBC0 +    target_func: 'dStockItem_c::setScalesOfSomeThings(void)' + +  - name: AddHammerPowerupFinalValue +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807B01F0 +    target_func: 'AddHammerPowerupFinalValue' + +  - {name: UpdCounts, type: patch, addr_pal: 0x807B02D8, data: '8085 0900'} +  - {name: UpdCounts, type: patch, addr_pal: 0x807B02E0, data: '9005 0900'} +  - {name: UpdCounts, type: patch, addr_pal: 0x807B02F0, data: '8084 0900'} +  - {name: UpdCounts, type: patch, addr_pal: 0x807B0304, data: '8003 0900'} +  - {name: UpdItemPtr, type: patch, addr_pal: 0x807B0310, data: '8063 08E0'} + +  - name: FixStockItemEffectPlayer +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807B04BC +    target_func: 'FixStockItemEffectPlayer' +  - name: FixStockItemEffectPlayer2 +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807B0580 +    target_func: 'FixStockItemEffectPlayer2' +  - name: FixMoreSIEffectRelatedCrap +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807B05E8 +    target_func: 'FixMoreSIEffectRelatedCrap' + +  - name: AddHammerSuitAddSound +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x807B0840 +    target_func: 'AddHammerSuitAddSound' + +  - {name: UpdCounts, type: patch, addr_pal: 0x807B0908, data: '8005 0900'} +  - {name: UpMaxItems, type: patch, addr_pal: 0x807B0934, data: '2C000008'} +  - {name: UpdCounts, type: patch, addr_pal: 0x807B0944, data: '8005 0900'} +  - {name: UpMaxItems, type: patch, addr_pal: 0x807B0954, data: '2C000008'} + +  - {name: UpdCounts, type: patch, addr_pal: 0x807B0A74, data: '809D 0900'} +  - {name: UpMaxItems, type: patch, addr_pal: 0x807B0A8C, data: '2C1B0008'} + +  - name: ResetHammerAnimOnOpen +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x807B0B38 +    target_func: 'ResetHammerAnimOnOpen' + +  - {name: UpdItemPtr, type: patch, addr_pal: 0x807B0B68, data: '807C 08E0'} +  - {name: UpdCounts, type: patch, addr_pal: 0x807B0B74, data: '801C 0900'} +  - {name: UpdItemPtr, type: patch, addr_pal: 0x807B0B80, data: '807C 08E0'} +  - {name: UpdItemPtr, type: patch, addr_pal: 0x807B0B8C, data: '807C 08E0'} +  - {name: UpMaxItems, type: patch, addr_pal: 0x807B0B9C, data: '2C1D0008'} + +  - {name: UpdCounts, type: patch, addr_pal: 0x807B0C28, data: '8003 0900'} + +  - {name: UpdCountsOffs, type: patch, addr_pal: 0x807B0C64, data: '801E 0900'} +  - {name: UpdCountsOffs, type: patch, addr_pal: 0x807B0C78, data: '801E 0904'} +  - {name: UpdCountsOffs, type: patch, addr_pal: 0x807B0C90, data: '801E 0908'} +  - {name: UpdCountsOffs, type: patch, addr_pal: 0x807B0CA8, data: '801E 090C'} +  - {name: UpdCountsOffs, type: patch, addr_pal: 0x807B0CC0, data: '801E 0910'} +  - {name: UpdCountsOffs, type: patch, addr_pal: 0x807B0CD8, data: '801E 0914'} +  - name: PickHammerAsPossibleStartChoice +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x807B0CF0 +    target_func: 'PickHammerAsPossibleStartChoice' + +  - name: ChooseOldButtonOffAnim +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807B0DB0 +    target_func: 'ChooseOldButtonOffAnim' + +  - name: ChooseOldButtonOffAnim2 +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807B0DF0 +    target_func: 'ChooseOldButtonOffAnim2' + +  - name: ChooseOldButtonOffAnim1b +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807B0E00 +    target_func: 'ChooseOldButtonOffAnim' + +  - name: ChooseButtonOnAnim +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807B0E14 +    target_func: 'ChooseButtonOnAnim' + +  - name: DoSISelectCursor +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x807B0EC4 +    target_func: 'DoSISelectCursor' + +  - {name: UpdItemPtr, type: patch, addr_pal: 0x807B1478, data: '807E 08E0'} +  - {name: UpMaxItems, type: patch, addr_pal: 0x807B148C, data: '2C1D0008'} + +  - name: ChooseHitButtonAnim +    type: branch_insn +    branch_type: bl +    src_addr_pal: 0x807B14FC +    target_func: 'ChooseHitButtonAnim' + +  - name: UpdateCalcPowerupResult +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x800FC9B4 +    target_func: 'UpdateCalcPowerupResult' + +# THE WONDERS OF STOCK ITEM SHADOW +# Current size: 0x280 +# New size: 0x290 +# New fields: +# - 0x284: Hammer value textbox +# - 0x288: Hammer X textbox +# - 0x28C: Hammer shadow +  - name: ExpandStockItemShadowStruct +    type: patch +    addr_pal: 0x807B2038 +    data: '38600290' + +  - name: SISLayoutExtraStuffs +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x807B225C +    target_func: 'SISLayoutExtraStuffs' + +  - name: UpdateSIS +    type: branch_insn +    branch_type: b +    src_addr_pal: 0x807B2524 +    target_func: 'UpdateSIS' + diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index e9ae989..f0a57af 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -109,14 +109,6 @@ dScKoopatlas_c::dScKoopatlas_c() : state(this) {  #define NPCHG_CCI(npc,idx) (((void**)(((u32)(npc))+0xA4))[(idx)])  #define NPCHG_2DPLAYER(npc,idx) (((void**)(((u32)(npc))+0x64C))[(idx)]) -#define STKI_SETUP_DONE(si) (*((bool*)(((u32)(si))+0x310))) -#define STKI_SHADOW(si) (*((void**)(((u32)(si))+0x310))) -#define STKI_2DPLAYER(si,idx) (((void**)(((u32)(si))+0x2E4))[(idx)]) -#define STKI_ITEM(si,idx) (((void**)(((u32)(si))+0x2F4))[(idx)]) -#define STKI_SHOW(si) (*((bool*)(((u32)(si))+0x8DD))) - -#define SIS_SETUP_DONE(sis) (*((bool*)(((u32)(sis))+0x260))) -  #define CCSB_ACTIVE(ccsb) (*((bool*)(((u32)(ccsb))+0x29C)))  #define CCSC_ACTIVE(ccsc) (*((bool*)(((u32)(ccsc))+0x2A1))) @@ -218,8 +210,8 @@ bool WMInit_SetupWait(void *ptr) {  	success &= NPCHG_SETUP_DONE(wm->numPeopleChange);  	success &= YESNO_SETUP_DONE(wm->yesNoWindow);  	success &= CONT_SETUP_DONE(wm->continueObj); -	success &= STKI_SETUP_DONE(wm->stockItem); -	success &= SIS_SETUP_DONE(wm->stockItemShadow); +	success &= wm->stockItem->layoutLoaded; +	success &= wm->stockItemShadow->layoutLoaded;  	success &= EASYP_SETUP_DONE(wm->easyPairing);  	return success; @@ -243,14 +235,14 @@ bool WMInit_SetupExtra(void *ptr) {  	// first up: player models for Stocked Items  	for (int i = 0; i < 4; i++) {  		void *obj = CreateChildObject(WM_2D_PLAYER, wm, i, 0, 0); -		STKI_2DPLAYER(wm->stockItem,i) = obj; +		wm->stockItem->player2d[i] = obj;  		NPCHG_2DPLAYER(wm->numPeopleChange,i) = obj;  	}  	// next: items for the Powerup screen -	for (int i = 0; i < 7; i++) { -		void *obj = CreateChildObject(WM_ITEM, wm, i, 0, 0); -		STKI_ITEM(wm->stockItem,i) = obj; +	for (int i = 0; i < 8; i++) { +		void *obj = CreateChildObject(WM_ITEM, wm, i==7?6:i, 0, 0); +		wm->stockItem->newItemPtr[i] = obj;  	}  	// need Player before we can set up paths @@ -398,10 +390,10 @@ int dScKoopatlas_c::onCreate() {  	this->continueObj = CreateParentedObject(CONTINUE, this, 0, 0);  	SpammyReport("stock item\n"); -	this->stockItem = CreateParentedObject(STOCK_ITEM, this, 0, 0); +	this->stockItem = (dStockItem_c*)CreateParentedObject(STOCK_ITEM, this, 0, 0);  	SpammyReport("stock item shadow\n"); -	this->stockItemShadow = CreateParentedObject(STOCK_ITEM_SHADOW, this, 0, 0); -	STKI_SHADOW(this->stockItem) = this->stockItemShadow; +	this->stockItemShadow = (dStockItemShadow_c*)CreateParentedObject(STOCK_ITEM_SHADOW, this, 0, 0); +	stockItem->shadow = stockItemShadow;  	SpammyReport("easy pairing\n");  	this->easyPairing = CreateParentedObject(EASY_PAIRING, this, 0, 0); @@ -516,11 +508,13 @@ void dScKoopatlas_c::executeState_Normal() {  	// Nothing related to the menu is going on  	if (nowPressed & WPAD_ONE) { -		STKI_SHOW(this->stockItem) = true; +		stockItem->show = true;  		state.setState(&StateID_PowerupsWait); +		hud->hideAll();  	} else if (nowPressed & WPAD_PLUS) {  		CSMENU_ACTIVE(this->csMenu) = true;  		state.setState(&StateID_CSMenu); +		hud->hideAll();  	} else if (nowPressed & WPAD_MINUS) {  		pathManager.unlockAllPaths(2);  	} else if (nowPressed & WPAD_A) { @@ -582,6 +576,7 @@ void dScKoopatlas_c::executeState_CSMenu() {  		} else {  			// Ok, change back to STATE_Normal +			hud->unhideAll();  			state.setState(&StateID_Normal);  		}  	} @@ -637,6 +632,7 @@ void dScKoopatlas_c::executeState_TitleConfirmHitWait() {  	if (!YESNO_OPENING(this->yesNoWindow)) {  		if (YESNO_CURRENT(this->yesNoWindow) == 1) {  			state.setState(&StateID_Normal); +			hud->unhideAll();  		} else {  			state.setState(&StateID_Limbo);  			StartTitleScreenStage(false, 0); @@ -680,6 +676,7 @@ void dScKoopatlas_c::executeState_PlayerChangeWait() {  			}  			state.setState(&StateID_Normal); +			hud->unhideAll();  		}  	} @@ -712,10 +709,11 @@ void dScKoopatlas_c::executeState_EasyPairingWait() {  // STATE_PowerupsWait : Wait for the user to exit the Powerups screen.  void dScKoopatlas_c::executeState_PowerupsWait() { -	if (!STKI_SHOW(this->stockItem)) { +	if (!stockItem->show) {  		player->modelHandler->mdlClass->setPowerup(Player_Powerup[0]);  		state.setState(&StateID_Normal); +		hud->unhideAll();  	}  } @@ -727,6 +725,7 @@ void dScKoopatlas_c::executeState_ShopWait() {  	if (!shop->visible) {  		state.setState(&StateID_Normal); +		hud->unhideAll();  	}  } @@ -738,6 +737,7 @@ void dScKoopatlas_c::executeState_CoinsWait() {  	if (!coins->visible) {  		state.setState(&StateID_Normal); +		hud->unhideAll();  	}  } @@ -793,6 +793,7 @@ void dScKoopatlas_c::executeState_SaveWindowClose() {  	if (!YESNO_VISIBLE(this->yesNoWindow)) {  		if (YESNO_CURRENT(this->yesNoWindow) == 1) {  			state.setState(&StateID_Normal); +			hud->unhideAll();  		} else {  			state.setState(&StateID_SaveDo);  			SaveGame(0, false); @@ -836,6 +837,7 @@ void dScKoopatlas_c::executeState_SaveEndCloseWait() {  	if (!YESNO_OPENING(this->yesNoWindow)) {  		state.setState(&StateID_Normal); +		hud->unhideAll();  	}  } @@ -891,6 +893,7 @@ void dScKoopatlas_c::executeState_QuickSaveWindowClose() {  	if (!YESNO_VISIBLE(this->yesNoWindow)) {  		if (YESNO_CURRENT(this->yesNoWindow) == 1) {  			state.setState(&StateID_Normal); +			hud->unhideAll();  		} else {  			state.setState(&StateID_QuickSaveDo);  			SaveGame(0, true); @@ -934,6 +937,7 @@ void dScKoopatlas_c::executeState_QuickSaveEndCloseWait() {  	if (!YESNO_OPENING(this->yesNoWindow)) {  		if (YESNO_CURRENT(this->yesNoWindow) == 1) {  			state.setState(&StateID_Normal); +			hud->unhideAll();  		} else {  			state.setState(&StateID_Limbo);  			StartTitleScreenStage(false, 0); diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 93cc257..788ad62 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -86,8 +86,8 @@ class dScKoopatlas_c : public dScene_c {  		void *numPeopleChange;  		void *yesNoWindow;  		void *continueObj; -		void *stockItem; -		void *stockItemShadow; +		dStockItem_c *stockItem; +		dStockItemShadow_c *stockItemShadow;  		void *easyPairing; diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 4d678c6..1032512 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -24,7 +24,9 @@ dWMHud_c::dWMHud_c() {  enum WMHudAnimation {  	SHOW_LIVES = 0,  	SHOW_HEADER, -	SHOW_FOOTER +	SHOW_FOOTER, +	HIDE_ALL, +	UNHIDE_ALL,  }; @@ -46,16 +48,23 @@ int dWMHud_c::onCreate() {  			layout.layout.rootPane->scale.y = 0.7711f;  		} -		static const char *brlanNames[2] = {"MapHUD_ShowMain.brlan", "MapHUD_ShowHeader.brlan"}; -		static const char *groupNames[3] = {"G_Lives", "G_Header", "G_Footer"}; +		static const char *brlanNames[] = { +			"MapHUD_ShowMain.brlan", "MapHUD_ShowHeader.brlan", +			"MapHUD_HideAll.brlan", "MapHUD_UnhideAll.brlan", +		}; +		static const char *groupNames[] = { +			"G_Lives", "G_Header", "G_Footer", +			"G_Hideables", "G_Hideables", +		}; -		layout.loadAnimations(brlanNames, 2); -		layout.loadGroups(groupNames, (int[3]){0, 1, 0}, 3); +		layout.loadAnimations(brlanNames, 4); +		layout.loadGroups(groupNames, (int[5]){0, 1, 0, 2, 3}, 5);  		layout.disableAllAnimations();  		layout.enableNonLoopAnim(SHOW_LIVES);  		layout.resetAnim(SHOW_FOOTER);  		layout.resetAnim(SHOW_HEADER); +		layout.resetAnim(HIDE_ALL);  		static const char *tbNames[2] = {"MenuButtonInfo", "ItemsButtonInfo"};  		layout.setLangStrings(tbNames, (int[2]){12, 15}, 4, 2); @@ -162,6 +171,14 @@ int dWMHud_c::onDraw() {  } +void dWMHud_c::hideAll() { +	layout.enableNonLoopAnim(HIDE_ALL); +} +void dWMHud_c::unhideAll() { +	layout.enableNonLoopAnim(UNHIDE_ALL); +} + +  void dWMHud_c::playShowAnim(int id) { diff --git a/src/koopatlas/hud.h b/src/koopatlas/hud.h index 32a09be..982b38a 100644 --- a/src/koopatlas/hud.h +++ b/src/koopatlas/hud.h @@ -27,6 +27,9 @@ class dWMHud_c : public dBase_c {  		void setupLives(); +		void hideAll(); +		void unhideAll(); +  	private:  		void playShowAnim(int id);  		void playHideAnim(int id); diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 6cff759..7f4b754 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -861,6 +861,7 @@ void dWMPathManager_c::activatePoint() {  		if (l == 98) {  			dWMShop_c::instance->show(w); +			dWMHud_c::instance->hideAll();  			dScKoopatlas_c::instance->state.setState(&dScKoopatlas_c::instance->StateID_ShopWait);  			return;  		} diff --git a/src/koopatlas/shop.cpp b/src/koopatlas/shop.cpp index 025a7d9..63d23e2 100644 --- a/src/koopatlas/shop.cpp +++ b/src/koopatlas/shop.cpp @@ -17,7 +17,6 @@ void dWMShop_c::ShopModel_c::setupItem(float x, float y, ItemTypes type) {  		{ "I_star", 		"g3d/I_star.brres", 			"I_star", 				"wait2" },  		{ "I_hammer", 		"g3d/I_fireflower.brres",		"I_fireflower",			"wait2" },  		{ "I_kinoko_bundle","g3d/I_life_kinoko.brres", 		"I_life_kinoko", 		"wait2" }, -		{ "obj_coin", 		"g3d/obj_coin.brres", 			"obj_coin", 			"wait2" }  	};  	this->x = x; @@ -33,12 +32,7 @@ void dWMShop_c::ShopModel_c::setupItem(float x, float y, ItemTypes type) {  	nw4r::g3d::ResMdl mdlRes = res.GetResMdl(Produce[id][2]);  	model.setup(mdlRes, &allocator, 0x224, 1, 0); -	if (type == COINS) { -		SetupTextures_MapObj(&model, 1); -		this->y += 20.0f; -		scaleFactor = 2.7f; -	} else -		SetupTextures_Item(&model, 1); +	SetupTextures_Item(&model, 1);  	nw4r::g3d::ResAnmChr anmChr = res.GetResAnmChr(Produce[id][3]);  	animation.setup(mdlRes, anmChr, &allocator, 0); @@ -194,6 +188,11 @@ int dWMShop_c::onCreate() {  			name[8] = crap[i*2];  			name[9] = crap[i*2+1];  			BtnRight[i] = layout.findPictureByName(name); + +			strcpy(name, "BtnXX"); +			name[3] = crap[i*2]; +			name[4] = crap[i*2+1]; +			Buttons[i] = layout.findPaneByName(name);  		}  		leftCol.setTexMap(BtnLeft[0]->material->texMaps); @@ -206,6 +205,8 @@ int dWMShop_c::onCreate() {  			rightCol.applyAlso(BtnRight[i]->material->texMaps);  		} +		Buttons[5]->size.x = 252.0f; // don't feel like editing rlyt +  		layoutLoaded = true;  	} @@ -301,7 +302,9 @@ void dWMShop_c::executeState_ButtonActivateWait() {  	if (!layout.isAnyAnimOn())  		state.setState(&StateID_Wait);  } -void dWMShop_c::endState_ButtonActivateWait() { OSReport("Wait"); } +void dWMShop_c::endState_ButtonActivateWait() { +	UpdateSelectCursor(Buttons[0], 0, false); +}  // Wait  void dWMShop_c::beginState_Wait() { timer = 1; MapSoundPlayer(SoundRelatedClass, SE_OBJ_CLOUD_BLOCK_TO_JUGEM, 1); } @@ -352,6 +355,7 @@ void dWMShop_c::executeState_Wait() {  		layout.enableNonLoopAnim(DEACTIVATE_BUTTON+selected);  		layout.enableNonLoopAnim(ACTIVATE_BUTTON+newSelection); +		UpdateSelectCursor(Buttons[newSelection], 0, false);  		selected = newSelection;  		if (newSelection <= 3) @@ -368,6 +372,8 @@ void dWMShop_c::beginState_HideWait() {  	timer = 26;  	MapSoundPlayer(SoundRelatedClass, SE_OBJ_CS_KINOHOUSE_DISAPP, 1); + +	HideSelectCursor(SelectCursorPointer, 0);  }  void dWMShop_c::executeState_HideWait() {  	if (timer > 0) { @@ -394,7 +400,6 @@ void dWMShop_c::endState_HideWait() {  	// 6 = Starman		- 2  		// 7 = Hammer		- 3  	// 8 = 1-ups		- 2 -// 9 = Coins		- 1  //  // Format: 1coin, 1coin, 2coins, 3coins, 5coins[3] (Value 6-9), 8coins[5] (Value 10-15)  // @@ -403,37 +408,37 @@ void dWMShop_c::endState_HideWait() {  const dWMShop_c::ItemTypes dWMShop_c::Inventory[10][12] = {   	{ // Yoshi's Island -		COINS, MUSHROOM, FIRE_FLOWER, PROPELLER, +		MUSHROOM, FIRE_FLOWER, ICE_FLOWER, PROPELLER,  		FIRE_FLOWER, ICE_FLOWER, FIRE_FLOWER,  		MUSHROOM, MUSHROOM, ONE_UP, PROPELLER, PROPELLER  	},  	{ // Desert -		COINS, MUSHROOM, FIRE_FLOWER, PROPELLER, +		MUSHROOM, FIRE_FLOWER, ICE_FLOWER, PROPELLER,  		FIRE_FLOWER, STARMAN, FIRE_FLOWER,  		MUSHROOM, FIRE_FLOWER, FIRE_FLOWER, PROPELLER, PROPELLER  	},  	{ // Mountain -		COINS, MUSHROOM, MINI_SHROOM, PROPELLER, +		MUSHROOM, FIRE_FLOWER, MINI_SHROOM, PROPELLER,  		MUSHROOM, MINI_SHROOM, PROPELLER,  		MUSHROOM, MINI_SHROOM, PROPELLER, PROPELLER, HAMMER  	},  	{ // Japan -		COINS, MUSHROOM, ONE_UP, HAMMER, +		MUSHROOM, FIRE_FLOWER, ONE_UP, HAMMER,  		ONE_UP, ONE_UP, ONE_UP,  		PROPELLER, ICE_FLOWER, ONE_UP, FIRE_FLOWER, PROPELLER  	},  	{ // FreezeFlame -		COINS, MUSHROOM, ICE_FLOWER, PENGUIN, +		MUSHROOM, FIRE_FLOWER, ICE_FLOWER, PENGUIN,  		ICE_FLOWER, PENGUIN, ICE_FLOWER,  		ICE_FLOWER, PENGUIN, PENGUIN, PENGUIN, ICE_FLOWER  	},  	{ // Ghost -		COINS, MUSHROOM, STARMAN, PROPELLER, +		MUSHROOM, FIRE_FLOWER, STARMAN, PROPELLER,  		MINI_SHROOM, PROPELLER, MINI_SHROOM, -		PROPELLER, PROPELLER, COINS, PROPELLER, PROPELLER +		PROPELLER, PROPELLER, MUSHROOM, PROPELLER, PROPELLER  	},  	{ // Space -		COINS, MUSHROOM, STARMAN, HAMMER, +		MUSHROOM, STARMAN, ONE_UP, HAMMER,  		STARMAN, STARMAN, STARMAN,  		HAMMER, HAMMER, ONE_UP, HAMMER, HAMMER  	}, @@ -443,12 +448,12 @@ const dWMShop_c::ItemTypes dWMShop_c::Inventory[10][12] = {  		PROPELLER, HAMMER, PROPELLER, HAMMER, PROPELLER  	},  	{ // Unknown -		COINS, MUSHROOM, FIRE_FLOWER, PENGUIN, +		MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM,  		MUSHROOM, MUSHROOM, MUSHROOM,  		MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM, MUSHROOM  	},  	{ // Goldwood -		MUSHROOM, ONE_UP, FIRE_FLOWER, MINI_SHROOM, +		MUSHROOM, FIRE_FLOWER, ONE_UP, PENGUIN,  		FIRE_FLOWER, PROPELLER, FIRE_FLOWER,  		FIRE_FLOWER, FIRE_FLOWER, STARMAN, FIRE_FLOWER, FIRE_FLOWER  	} @@ -528,7 +533,7 @@ void dWMShop_c::loadInfo() {  void dWMShop_c::buyItem(int item) {  	static int itemDefs[6][3] = {  		// Cost, Start Index, Count -		{1, 0, 1}, {1, 1, 1}, {2, 2, 1}, {3, 3, 1}, +		{1, 0, 1}, {2, 1, 1}, {2, 2, 1}, {3, 3, 1},  		{5, 4, 3}, {8, 7, 5}  	}; @@ -542,7 +547,6 @@ void dWMShop_c::buyItem(int item) {  	MapSoundPlayer(SoundRelatedClass, SE_SYS_DECIDE, 1); -  	SaveFile *file = GetSaveFile();  	SaveBlock *block = file->GetBlock(file->header.current_file); @@ -558,32 +562,28 @@ void dWMShop_c::buyItem(int item) {  		appliedItems[(int)Inventory[shopKind][invStartIndex]]++;  	// TODO: Make this work with hammers -	for (int i = 0; i < 7; i++) { +	for (int i = 0; i < 8; i++) {  		block->powerups_available[i] += appliedItems[i];  		if (block->powerups_available[i] > 99)  			block->powerups_available[i] = 99; + +		dScKoopatlas_c::instance->stockItem->counts[i] = block->powerups_available[i];  	} -	// Apply coins and lives to everyone +	// Apply lives to everyone  	for (int i = 0; i < 4; i++) { -		block->player_coins[i] += (appliedItems[(int)COINS] * 50); - -		while (block->player_coins[i] >= 100) { -			block->player_coins[i] -= 100; -			block->player_lives[i]++; -		} - -		block->player_lives[i] += appliedItems[(int)ONE_UP]; -		if (block->player_lives[i] > 99) -			block->player_lives[i] = 99; +		Player_Lives[i] += appliedItems[(int)ONE_UP]; +		if (Player_Lives[i] > 99) +			Player_Lives[i] = 99;  	} +	if (appliedItems[(int)ONE_UP] > 0) +		MapSoundPlayer(SoundRelatedClass, SE_SYS_100COIN_ONE_UP, 1); +  	// load the coin count  	int scCount = getUnspentStarCoinCount();  	WriteNumberToTextBox(&scCount, CoinCount, false);  	WriteNumberToTextBox(&scCount, CoinCountShadow, false); - -	state.setState(&StateID_HideWait);  } diff --git a/src/koopatlas/shop.h b/src/koopatlas/shop.h index fb948a9..4a79861 100644 --- a/src/koopatlas/shop.h +++ b/src/koopatlas/shop.h @@ -44,7 +44,6 @@ class dWMShop_c : public dActor_c {  			STARMAN,  			HAMMER,  			ONE_UP, -			COINS,  			ITEM_TYPE_COUNT  		}; @@ -62,6 +61,9 @@ class dWMShop_c : public dActor_c {  		nw4r::lyt::Picture  			*BtnLeft[6], *BtnMid[6], *BtnRight[6]; +		nw4r::lyt::Pane +			*Buttons[6]; +  		dTexMapColouriser_c leftCol, midCol, rightCol;  		class ShopModel_c { diff --git a/src/poweruphax.S b/src/poweruphax.S index ef957e2..16800e6 100644 --- a/src/poweruphax.S +++ b/src/poweruphax.S @@ -1044,3 +1044,376 @@ StrongboxGiveBattleItem:  .data  IndexItemsForStockItem:  .byte 0,1,2,4,5,6,3,7 + + +SLGWindow: .string "A00_Window" +SLGBtn0: .string "B00_itemButton" +SLGBtn1: .string "B01_itemButton" +SLGBtn2: .string "B02_itemButton" +SLGBtn3: .string "B03_itemButton" +SLGBtn4: .string "B04_itemButton" +SLGBtn5: .string "B05_itemButton" +SLGBtn6: .string "B06_itemButton" +SLGBtn7: .string "HammerGroup" +SLButtonBase00: .string "P_buttonBase_00" +SLButtonBase01: .string "P_buttonBase_01" +SLButtonBase02: .string "P_buttonBase_02" +SLButtonBase03: .string "P_buttonBase_03" +SLButtonBase04: .string "P_buttonBase_04" +SLButtonBase05: .string "P_buttonBase_05" +SLButtonBase06: .string "P_buttonBase_06" +SLButtonBase07: .string "P_buttonBase_07" +SLIcon0: .string "P_iconKinoko_00" +SLIcon1: .string "P_iconFlower_00" +SLIcon2: .string "P_iconPro_00" +SLIcon3: .string "P_iconIce_00" +SLIcon4: .string "P_iconPen_00" +SLIcon5: .string "P_mameKinoko_00" +SLIcon6: .string "P_iconStar_00" +SLIcon7: .string "P_iconHammer_00" +SLIconPane0: .string "N_iconKinoko_00" +SLIconPane1: .string "N_iconFlower_00" +SLIconPane2: .string "N_iconPro_00" +SLIconPane3: .string "N_iconIce_00" +SLIconPane4: .string "N_iconPen_00" +SLIconPane5: .string "N_mameKinoko_00" +SLIconPane6: .string "N_iconStar_00" +SLIconPane7: .string "N_iconHammer_00" +.align 4 +SILayoutGroupNames: +.long SLGWindow +.long SLGBtn0,SLGBtn1,SLGBtn2,SLGBtn6,SLGBtn4,SLGBtn5,SLGBtn3 +.long SLGBtn0,SLGBtn1,SLGBtn2,SLGBtn6,SLGBtn4,SLGBtn5,SLGBtn3 +.long SLGBtn0,SLGBtn1,SLGBtn2,SLGBtn6,SLGBtn4,SLGBtn5,SLGBtn3 +.long SLGBtn0,SLGBtn1,SLGBtn2,SLGBtn6,SLGBtn4,SLGBtn5,SLGBtn3 +.long SLGWindow +.long SLGBtn7,SLGBtn7,SLGBtn7 +SILayoutGroupIDs: +.long 0 +.long 1,1,1,1,1,1,1 +.long 2,2,2,2,2,2,2 +.long 3,3,3,3,3,3,3 +.long 4,4,4,4,4,4,4 +.long 5 +.long 1,3,4 + +SILayoutButtonBases: +.long SLButtonBase00,SLButtonBase01,SLButtonBase02,SLButtonBase06 +.long SLButtonBase04,SLButtonBase05,SLButtonBase03,SLButtonBase07 +SILayoutIconPictures: +.long SLIcon0,SLIcon1,SLIcon2,SLIcon3 +.long SLIcon4,SLIcon5,SLIcon6,SLIcon7 +SILayoutIconPanes: +.long SLIconPane0,SLIconPane1,SLIconPane2,SLIconPane3 +.long SLIconPane4,SLIconPane5,SLIconPane6,SLIconPane7 + +.text +.global SILayoutGroupParams +SILayoutGroupParams: +	lis r4, SILayoutGroupNames@h +	ori r4, r4, SILayoutGroupNames@l +	lis r5, SILayoutGroupIDs@h +	ori r5, r5, SILayoutGroupIDs@l +	li r6, 0x21 +	blr + +# - 0x920 : Button Bases +# - 0x940 : Icon Panes +# - 0x960 : Icon Pictures +.extern getPanes__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt4Panei +.extern getPictures__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt7Picturei +.extern ContinueFromSILayoutExtraStuffs +.global SILayoutExtraStuffs +SILayoutExtraStuffs: +	addi r3, r30, 0x74 +	lis r4, SILayoutButtonBases@h +	ori r4, r4, SILayoutButtonBases@l +	addi r5, r30, 0x920 +	li r6, 8 +	bl getPictures__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt7Picturei + +	addi r3, r30, 0x74 +	lis r4, SILayoutIconPanes@h +	ori r4, r4, SILayoutIconPanes@l +	addi r5, r30, 0x940 +	li r6, 8 +	bl getPanes__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt4Panei + +	addi r3, r30, 0x74 +	lis r4, SILayoutIconPictures@h +	ori r4, r4, SILayoutIconPictures@l +	addi r5, r30, 0x960 +	li r6, 8 +	bl getPictures__Q23m2d13EmbedLayout_cCFPPCcPPQ34nw4r3lyt7Picturei + +	li r3, 1 +	b ContinueFromSILayoutExtraStuffs + +.global HideItemsByDefault +.extern ContinueFromHideItemsByDefault +HideItemsByDefault: +	li r3, 8 +	mtctr r3 +	mr r4, r31 +meNext: +	lwz r9, 0x960(r4) +	lbz r5, 0xBB(r9) +	rlwinm r5, r5, 0,24,30 +	stb r5, 0xBB(r9) +	addi r4, r4, 4 +	bdnz meNext + +	li r8, 0 +	li r7, 1 +	li r6, 4 +	li r5, 0xE +	li r0, 0xF +	li r3, 1 +	b ContinueFromHideItemsByDefault + +.global AddHammerPowerupFinalValue +AddHammerPowerupFinalValue: +	li r24, 0 +	lis r22, OutputPowerupsByItemID@h +	ori r22, r22, OutputPowerupsByItemID@l +	blr + +.data +OutputPowerupsByItemID: +.long 1, 2, 4, 6, 5, 3, -1, 7 + +.text +.global FixStockItemEffectPlayer +FixStockItemEffectPlayer: +	lwz r0, 0x8A0(r30) +	slwi r0, r0, 2 +	add r5, r30, r0 +	lwz r28, 0x940(r5) +	blr + +.global FixStockItemEffectPlayer2 +FixStockItemEffectPlayer2: +	lwz r0, 0x8A0(r30) +	stw r0, 0x8D0(r30) +	blr + +.global FixMoreSIEffectRelatedCrap +FixMoreSIEffectRelatedCrap: +	lwz r0, 0x8D0(r31) +	slwi r0, r0, 2 +	add r3, r31, r0 +	lwz r29, 0x940(r3) +	blr + + +.global AddHammerSuitAddSound +.extern MakeSFISound +.extern ContinueFromSIAddSound +AddHammerSuitAddSound: +	cmpwi r0, 7 +	beq _MakeSFISound +	b ContinueFromSIAddSound +	_MakeSFISound: +	b MakeSFISound + +.extern resetAnim__Q23m2d13EmbedLayout_cFib +.extern ContinueFromResetHammerAnimOnOpen +.global ResetHammerAnimOnOpen +ResetHammerAnimOnOpen: +	addi r3, r28, 0x74 +	li r4, 0x1E +	li r5, 0 +	bl resetAnim__Q23m2d13EmbedLayout_cFib +	addi r3, r28, 0x74 +	b ContinueFromResetHammerAnimOnOpen + +.extern ChosenStartChoice +.global PickHammerAsPossibleStartChoice +PickHammerAsPossibleStartChoice: +	lwz r0, 0x918(r30) +	li r3, 6 +	cmpwi r0, 0 +	beq notGoodEnough +	stw r3, 0x8A0(r30) +	b ChosenStartChoice +notGoodEnough: +	lwz r0, 0x91C(r30) +	li r3, 7 +	cmpwi r0, 0 +	b _ChosenStartChoice +	stw r3, 0x8A0(r30) +	_ChosenStartChoice: +	b ChosenStartChoice + + +.global ChooseOldButtonOffAnim +ChooseOldButtonOffAnim: +	cmpwi r4, 7 +	beq useHammerOffAnim +	addi r4, r4, 0x16 +	blr +useHammerOffAnim: +	li r4, 0x20 +	blr + +.global ChooseOldButtonOffAnim2 +ChooseOldButtonOffAnim2: +	cmpwi r3, 7 +	beq useHammerOffAnim2 +	addi r0, r3, 0x16 +	blr +useHammerOffAnim2: +	li r0, 0x20 +	blr + +.global ChooseButtonOnAnim +ChooseButtonOnAnim: +	cmpwi r4, 7 +	beq useHammerOnAnim +	addi r4, r4, 1 +	blr +useHammerOnAnim: +	li r4, 0x1E +	blr + +.global DoSISelectCursor +.extern UpdateSelectCursor +DoSISelectCursor: +	slwi r0, r0, 2 +	add r3, r3, r0 +	lwz r3, 0x920(r3) +	b UpdateSelectCursor + + +.global ChooseHitButtonAnim +ChooseHitButtonAnim: +	cmpwi r4, 7 +	beq useHammerHitAnim +	addi r4, r4, 0xF +	blr +useHammerHitAnim: +	li r4, 0x1F +	blr + + + +.global UpdateCalcPowerupResult +.extern ContinueFromCalcPowerupResult +UpdateCalcPowerupResult: +	cmpwi r3, 7 +	bne cprIsDone +	li r6, 7 +	stb r0, 0xF(r1) +cprIsDone: +	b ContinueFromCalcPowerupResult + + + + +.global SISLayoutExtraStuffs +.extern ContinueFromSISLayoutExtraStuffs +.extern findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc +.extern findPictureByName__Q23m2d17EmbedLayoutBase_cCFPCc +SISLayoutExtraStuffs: +	addi r3, r30, 0x70 +	lis r4, whatever_s@h +	ori r4, r4, whatever_s@l +	bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc +	stw r3, 0x288(r30) + +	addi r3, r30, 0x70 +	lis r4, fuck_brlyts@h +	ori r4, r4, fuck_brlyts@l +	bl findTextBoxByName__Q23m2d17EmbedLayoutBase_cCFPCc +	stw r3, 0x284(r30) + +	addi r3, r30, 0x70 +	lis r4, im_tired_of_this@h +	ori r4, r4, im_tired_of_this@l +	bl findPictureByName__Q23m2d17EmbedLayoutBase_cCFPCc +	stw r3, 0x28C(r30) +	 +	li r3, 1 +	b ContinueFromSISLayoutExtraStuffs + +.data +whatever_s: .string "whatever" +fuck_brlyts: .string "fuck_brlyts" +im_tired_of_this: .string "im_tired_of_this" + +.text +.global UpdateSIS +.extern ContinueFromUpdateSIS +.extern WriteNumberToTextBox__FPiPCiPQ34nw4r3lyt7TextBoxb +UpdateSIS: +	cmpwi r0, 0 +	beq DontUpdateSIS +	subi r25, r25, 0x1C + +	# replicate this shit +	lwz r0, 0x280(r25) +	cmpwi r0, 0 +	lwz r3, 0x28C(r25) +	lbz r0, 0xBB(r3) +	beq theresNone + +	li r4, 1 +	rlwinm r0, r0, 0,24,30 +	b changedBase +theresNone: +	li r4, 0 +	ori r0, r0, 1 +changedBase: +	stb r0, 0xBB(r3) +	slwi r29, r4, 2 +	addi r5, r1, 0x14 +	lwzx r27, r26, r29 +	li r4, 0 +	stw r27, 0x14(r1) +	lwz r3, 0x284(r25) +	lwz r12, 0(r3) +	lwz r12, 0x28(r12) +	mtctr r12 +	bctrl + +	lwzx r29, r28, r29 +	addi r5, r1, 0x10 +	stw r29, 0x10(r1) +	li r4, 2 +	lwz r3, 0x284(r25) +	lwz r12, 0(r3) +	lwz r12, 0x28(r12) +	mtctr r12 +	bctrl + +	addi r5, r1, 0x14 +	li r4, 0 +	lwz r3, 0x288(r25) +	lwz r12, 0(r3) +	lwz r12, 0x28(r12) +	mtctr r12 +	bctrl + +	addi r5, r1, 0x10 +	li r4, 2 +	lwz r3, 0x288(r25) +	lwz r12, 0(r3) +	lwz r12, 0x28(r12) +	mtctr r12 +	bctrl + +	lwz r5, 0x284(r25) +	addi r3, r25, 0x280 +	lis r4, ptrToTwo@h +	ori r4, r4, ptrToTwo@l +	li r6, 1 +	bl WriteNumberToTextBox__FPiPCiPQ34nw4r3lyt7TextBoxb + +DontUpdateSIS: +	addi r11, r1, 0x40 +	b ContinueFromUpdateSIS + +.data +.align 4 +ptrToTwo: .long 2 + diff --git a/src/poweruphax.cpp b/src/poweruphax.cpp index e1dbb87..5140843 100644 --- a/src/poweruphax.cpp +++ b/src/poweruphax.cpp @@ -97,3 +97,81 @@ void dHammerSuitRenderer_c::draw() {  	shell.scheduleForDrawing();  } + + + + + + + +// NEW VERSION +void CrapUpPositions(Vec *out, const Vec *in); + +void dStockItem_c::setScalesOfSomeThings() { +	nw4r::lyt::Pane *ppos = N_forUse_PPos[playerCount]; + +	int howManyPlayers = 0; +	for (int i = 0; i < 4; i++) { +		if (isPlayerActive[i]) { +			int picID = getIconPictureIDforPlayer(i); +			int charID = Player_ID[i]; + +			if (picID != 24) { +				nw4r::lyt::Picture *pic = P_icon[picID]; + +				Vec in, out; + +				in.x = pic->effectiveMtx[0][3]; +				in.y = pic->effectiveMtx[1][3]; +				in.z = pic->effectiveMtx[2][3]; + +				CrapUpPositions(&out, &in); + +				u8 *wmp = (u8*)player2d[charID]; +				*((float*)(wmp+0xAC)) = out.x; +				*((float*)(wmp+0xB0)) = out.y; +				*((float*)(wmp+0xB4)) = out.z; +				*((float*)(wmp+0x220)) = 0.89999998f; +				*((float*)(wmp+0x224)) = 0.89999998f; +				*((float*)(wmp+0x228)) = 0.89999998f; +				*((float*)(wmp+0x25C)) = 26.0f; +			} +			howManyPlayers++; +		} +	} + + +	for (int i = 0; i < 8; i++) { +		u8 *item = (u8*)newItemPtr[i]; + +		nw4r::lyt::Pane *icon = newIconPanes[i]; + +		Vec in, out; +		in.x = icon->effectiveMtx[0][3]; +		in.y = icon->effectiveMtx[1][3]; +		in.z = icon->effectiveMtx[2][3]; + +		CrapUpPositions(&out, &in); + +		*((float*)(item+0xAC)) = out.x; +		*((float*)(item+0xB0)) = out.y; +		*((float*)(item+0xB4)) = out.z; +		*((float*)(item+0x1F4)) = P_buttonBase[i]->scale.x; +		*((float*)(item+0x1F8)) = P_buttonBase[i]->scale.y; +		*((float*)(item+0x1FC)) = 1.0f; +	} + + +	nw4r::lyt::Pane *shdRoot = shadow->rootPane; +	shdRoot->trans.x = N_stockItem->effectiveMtx[0][3]; +	shdRoot->trans.y = N_stockItem->effectiveMtx[1][3]; +	shdRoot->trans.z = N_stockItem->effectiveMtx[2][3]; +	shdRoot->scale.x = N_stockItem_01->effectiveMtx[0][0]; +	shdRoot->scale.y = N_stockItem_01->effectiveMtx[1][1]; + +	for (int i = 0; i < 7; i++) +		shadow->buttonBases[i]->scale = newButtonBase[i]->scale; +	shadow->hammerButtonBase->scale = newButtonBase[7]->scale; +} + +  | 
