From 64cd97926e2a45f5220a23626721e60d0ceacfae Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 7 Feb 2013 03:45:53 +0100 Subject: various fixes to Layout code --- src/koopatlas/hud.cpp | 8 ++++++-- src/koopatlas/shop.cpp | 33 +++++++++++++++++++++++++++------ src/koopatlas/shop.h | 2 +- src/koopatlas/starcoin.cpp | 2 +- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 157821b..ce54d8f 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -36,14 +36,18 @@ int dWMHud_c::onCreate() { bool output = layout.build("maphud.brlyt"); - if (!IsWideScreen()) { + layout.layout.rootPane->trans.x = -112.0f; + if (IsWideScreen()) { + layout.layout.rootPane->scale.x = 0.735f; + } else { layout.clippingEnabled = true; layout.clipX = 0; layout.clipY = 52; layout.clipWidth = 640; layout.clipHeight = 352; - layout.layout.rootPane->scale.x = 0.7711f; + layout.layout.rootPane->scale.x = 0.731f; layout.layout.rootPane->scale.y = 0.7711f; + layout.drawInfo._50 &= ~0x20; } static const char *brlanNames[] = { diff --git a/src/koopatlas/shop.cpp b/src/koopatlas/shop.cpp index e3cade7..27f6077 100644 --- a/src/koopatlas/shop.cpp +++ b/src/koopatlas/shop.cpp @@ -141,7 +141,7 @@ int dWMShop_c::onCreate() { layout.clipY = 52; layout.clipWidth = 640; layout.clipHeight = 352; - layout.layout.rootPane->scale.x = 0.7711f; + layout.layout.rootPane->scale.x = 0.731f; layout.layout.rootPane->scale.y = 0.7711f; } @@ -200,6 +200,10 @@ int dWMShop_c::onCreate() { Buttons[i] = layout.findPaneByName(name); } + Btn1Base = layout.findPaneByName("Btn1_Base"); + Btn2Base = layout.findPaneByName("Btn2_Base"); + OSReport("Found btn 1,2: %p, %p\n", Btn1Base, Btn2Base); + leftCol.setTexMap(BtnLeft[0]->material->texMaps); midCol.setTexMap(BtnMid[0]->material->texMaps); rightCol.setTexMap(BtnRight[0]->material->texMaps); @@ -210,8 +214,6 @@ int dWMShop_c::onCreate() { rightCol.applyAlso(BtnRight[i]->material->texMaps); } - Buttons[5]->size.x = 252.0f; // don't feel like editing rlyt - layoutLoaded = true; } @@ -363,7 +365,11 @@ void dWMShop_c::executeState_Wait() { layout.enableNonLoopAnim(DEACTIVATE_BUTTON+selected); layout.enableNonLoopAnim(ACTIVATE_BUTTON+newSelection); - UpdateSelectCursor(Buttons[newSelection], 0, false); + switch (newSelection) { + case 4: UpdateSelectCursor(Btn1Base, 0, false); break; + case 5: UpdateSelectCursor(Btn2Base, 0, false); break; + default: UpdateSelectCursor(Buttons[newSelection], 0, false); + } selected = newSelection; if (newSelection <= 3) @@ -472,6 +478,12 @@ void dWMShop_c::loadModels() { lakituModel->setupLakitu(shopKind); lakituModel->x = 240.0f; lakituModel->y = 220.0f; + if (!IsWideScreen()) { + lakituModel->x = (0.731f * (lakituModel->x + 416.0f)) - 292.0f; + lakituModel->y *= 0.7711f; + lakituModel->y += 52.0f; + lakituModel->scaleFactor = 0.77f; + } static const float itemPos[ITEM_COUNT][2] = { {357.0f, 276.0f}, @@ -491,8 +503,17 @@ void dWMShop_c::loadModels() { }; itemModels = new ShopModel_c[ITEM_COUNT]; - for (int i = 0; i < ITEM_COUNT; i++) - itemModels[i].setupItem(itemPos[i][0], itemPos[i][1], Inventory[shopKind][i]); + for (int i = 0; i < ITEM_COUNT; i++) { + float effectiveX = itemPos[i][0]; + float effectiveY = itemPos[i][1]; + if (!IsWideScreen()) { + effectiveX = (0.731f * (effectiveX + 416.0f)) - 296.0f; + effectiveY *= 0.7711f; + effectiveY += 50.0f; + itemModels[i].scaleFactor = 1.6f; + } + itemModels[i].setupItem(effectiveX, effectiveY, Inventory[shopKind][i]); + } } void dWMShop_c::deleteModels() { if (lakituModel) diff --git a/src/koopatlas/shop.h b/src/koopatlas/shop.h index 1e88e72..d7dcc67 100644 --- a/src/koopatlas/shop.h +++ b/src/koopatlas/shop.h @@ -62,7 +62,7 @@ class dWMShop_c : public dActor_c { *BtnLeft[6], *BtnMid[6], *BtnRight[6]; nw4r::lyt::Pane - *Buttons[6]; + *Buttons[6], *Btn1Base, *Btn2Base; dTexMapColouriser_c leftCol, midCol, rightCol; diff --git a/src/koopatlas/starcoin.cpp b/src/koopatlas/starcoin.cpp index a7a019a..fc46c8c 100644 --- a/src/koopatlas/starcoin.cpp +++ b/src/koopatlas/starcoin.cpp @@ -42,7 +42,7 @@ int dWMStarCoin_c::onCreate() { layout.clipY = 52; layout.clipWidth = 640; layout.clipHeight = 352; - layout.layout.rootPane->scale.x = 0.7711f; + layout.layout.rootPane->scale.x = 0.731f; layout.layout.rootPane->scale.y = 0.7711f; } -- cgit v1.2.3