summaryrefslogtreecommitdiff
path: root/src/koopatlas
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-07-27 19:14:06 -0500
committerColin Noga <Tempus@chronometry.ca>2012-07-27 19:14:06 -0500
commit2226bfeb0dc0892e7aaa9a507031c42515c0ef00 (patch)
tree0fc84be92609d5df05f8634a143907a29b1117f4 /src/koopatlas
parent71cc3964b04788bb784de0b81d03e97e0699d383 (diff)
downloadkamek-2226bfeb0dc0892e7aaa9a507031c42515c0ef00.tar.gz
kamek-2226bfeb0dc0892e7aaa9a507031c42515c0ef00.zip
Fixed up Starcoin menu
Diffstat (limited to 'src/koopatlas')
-rw-r--r--src/koopatlas/core.cpp1
-rw-r--r--src/koopatlas/pathmanager.cpp2
-rw-r--r--src/koopatlas/starcoin.cpp95
-rw-r--r--src/koopatlas/starcoin.h6
4 files changed, 56 insertions, 48 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index c40614b..4709d8e 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -152,6 +152,7 @@ bool WMInit_LoadSIAnims(void *ptr) {
DVD_LoadFile(GetDVDClass(), "Object", "I_star", 0);
DVD_LoadFile(GetDVDClass(), "Object", "I_kinoko_bundle", 0);
DVD_LoadFile(GetDVDClass(), "Object", "lakitu", 0);
+ DVD_LoadFile(GetDVDClass(), "Object", "star_coin", 0);
return true;
}
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 1b20ebf..0b3f012 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -506,7 +506,7 @@ void dWMPathManager_c::moveThroughPath() {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
save->current_world = dScKoopatlas_c::instance->getIndexForMapName(to->destMap);
- SpammyReport("Change to map ID %d (%s), entrance ID %d\n", save->current_world, to->destMap, to->foreignID);
+ OSReport("Change to map ID %d (%s), entrance ID %d\n", save->current_world, to->destMap, to->foreignID);
DoSceneChange(WORLD_MAP, 0x10000000 | to->foreignID, 0);
diff --git a/src/koopatlas/starcoin.cpp b/src/koopatlas/starcoin.cpp
index f47d342..22fd044 100644
--- a/src/koopatlas/starcoin.cpp
+++ b/src/koopatlas/starcoin.cpp
@@ -1,5 +1,5 @@
#include "koopatlas/starcoin.h"
-
+#include <game.h>
int getStarCoinCountCoins() {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
@@ -48,13 +48,14 @@ int dWMStarCoin::onCreate() {
if (!gotFile)
return false;
- currentItem = 0;
-
static const char *brlanNames[2] = {"coin_inWindow.brlan", "coin_outWindow.brlan"};
static const char *groupNames[2] = {"A00_Window", "A00_Window"};
bool output = layout.build("coin.brlyt");
+ nw4r::lyt::Pane *red = layout.findPictureByName("red");
+ red->alpha = 0;
+
if (!IsWideScreen()) {
layout.clippingEnabled = true;
layout.clipX = 0;
@@ -116,9 +117,9 @@ int dWMStarCoin::onDraw() {
void dWMStarCoin::specialDraw1() {
if (!isHidden) {
- Vec pos = {250.0f, 170.0f, 1000.0f};
- S16Vec rot = {rotation,0,0};
- Vec scale = {1.0f, 1.0f, 1.0f};
+ Vec pos = {330.0f, 250.0f, -1000.0f};
+ S16Vec rot = {0,rotation,0};
+ Vec scale = {2.0f, 2.0f, 2.0f};
matrix.translation(pos.x, pos.y, pos.z);
matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z);
@@ -137,7 +138,7 @@ void dWMStarCoin::LoadCoinsForWorld(int world) {
if (!isHidden) {
return; }
- u8 levelArray[] = {
+ int levelArray[14][2][8] = {
{
{1,2,3,4,15},
{5,6,7,8,25,38}
@@ -207,7 +208,7 @@ void dWMStarCoin::LoadCoinsForWorld(int world) {
{19,22,23,24,25},
{}
}
- }
+ };
// Handle showing it
MapSoundPlayer(SoundRelatedClass, SE_SYS_DIALOGUE_IN, 1);
@@ -220,7 +221,7 @@ void dWMStarCoin::LoadCoinsForWorld(int world) {
res.data = getResource("star_coin", "g3d/star_coin.brres");
nw4r::g3d::ResMdl mdl = res.GetResMdl("star_coinA");
shopkeep.setup(mdl, &allocator, 0x224, 1, 0);
- SetupTextures_Item(&shopkeep, 1);
+ SetupTextures_MapObj(&shopkeep, 1);
allocator.unlink();
@@ -235,7 +236,7 @@ void dWMStarCoin::LoadCoinsForWorld(int world) {
// Display World Name
- setWorldName(int world);
+ setWorldName(world);
// Display Per level coins
@@ -247,28 +248,40 @@ void dWMStarCoin::LoadCoinsForWorld(int world) {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
for (int l = 0; l < 2; l++) {
- while (levelArray[world-1][l][i]) {
+ for (int i = 0; i < 8; i++) {
+
+ int levelNum = levelArray[world][l][i];
- dLevelInfo_c *li = &dScKoopatlas_c::instance->levelInfo;
- dLevelInfo_c::entry_s *entry = li->search(world - 1, levelArray[world-1][l][i] - 1);
+ char levelPane[11];
+ sprintf(levelPane, "T_level_%02d", i+j);
- setText(li->getNameForLevel(entry);, "T_level_01");
+ if (levelArray[world][l][i]) {
+ levelNum--;
+ dLevelInfo_c *li = &dScKoopatlas_c::instance->levelInfo;
+ dLevelInfo_c::entry_s *entry = li->search(world, levelNum);
+
+ setText(li->getNameForLevel(entry), levelPane);
+ totalCoins += 3;
+ }
+ else {
+ setText(" ", levelPane);
+ }
bool collect;
- collect = CheckIfCoinCollected(world - 1, l, 0);
+ u32 conds = save->GetLevelCondition(world, i+j);
+
+ collect = conds & COND_COIN1;
setCoin(collect, 1, i+j);
if (collect) { currentCoins++; }
- collect = CheckIfCoinCollected(world - 1, l, 1);
+ collect = conds & COND_COIN2;
setCoin(collect, 2, i+j);
if (collect) { currentCoins++; }
- collect = CheckIfCoinCollected(world - 1, l, 2);
+ collect = conds & COND_COIN3;
setCoin(collect, 3, i+j);
if (collect) { currentCoins++; }
- totalCoins += 3;
- i++;
}
j += 8;
i = 0;
@@ -289,28 +302,21 @@ void dWMStarCoin::LoadCoinsForWorld(int world) {
void dWMStarCoin::setCoin(bool on, int coin, int slot) {
+ char coinOn[16];
+ char coinOff[16];
if (coin == 1) {
- char coinOn [14];
sprintf(coinOn, "P_first_on_%02d", slot);
-
- char coinOff [15];
sprintf(coinOff, "P_first_off_%02d", slot);
- } else if {
- char coinOn [15];
+ } else if (coin == 2) {
sprintf(coinOn, "P_second_on_%02d", slot);
-
- char coinOff [16];
sprintf(coinOff, "P_second_off_%02d", slot);
- } else if {
- char coinOn [14];
+ } else if (coin == 3) {
sprintf(coinOn, "P_third_on_%02d", slot);
-
- char coinOff [15];
sprintf(coinOff, "P_third_off_%02d", slot);
} else { return; }
- nw4r::lyt::Pane picOn = layout.findPictureByName(coinOn);
- nw4r::lyt::Pane picOff = layout.findPictureByName(coinOff);
+ nw4r::lyt::Pane *picOn = layout.findPictureByName(coinOn);
+ nw4r::lyt::Pane *picOff = layout.findPictureByName(coinOff);
if (on) {
picOn->alpha = 0xFF;
@@ -348,60 +354,61 @@ void dWMStarCoin::setText(const char *str, const char *name) {
float width = tw.CalcStringWidth(newString, wlength);
SpammyReport("Text width: %f\n", width);
+ OSReport("Setting text: %s", newString);
box->SetString(newString);
}
void dWMStarCoin::setWorldName(int world) {
- switch (world) {
+ switch (world+1) {
case 1:
setText("Yoshi's Island", "T_lefttitle_01");
- setText("Yoshi's Island", "T_righttitle_01")l
+ setText("Yoshi's Island", "T_righttitle_01");
break;
case 2:
setText("Soggy Sewers", "T_lefttitle_01");
- setText("Rubble Ruins", "T_righttitle_01")l
+ setText("Rubble Ruins", "T_righttitle_01");
break;
case 3:
setText("Mushroom Peaks", "T_lefttitle_01");
- setText("Mushroom Peaks", "T_righttitle_01")l
+ setText("Mushroom Peaks", "T_righttitle_01");
break;
case 4:
setText("Sakura Village", "T_lefttitle_01");
- setText("Sakura Village", "T_righttitle_01")l
+ setText("Sakura Village", "T_righttitle_01");
break;
case 5:
setText("FreezeFlame Valley", "T_lefttitle_01");
- setText("FreezeFlame Volcano", "T_righttitle_01")l
+ setText("FreezeFlame Volcano", "T_righttitle_01");
break;
case 6:
setText("Pumpkin Boneyard", "T_lefttitle_01");
- setText("Pumpkin Boneyard", "T_righttitle_01")l
+ setText("Pumpkin Boneyard", "T_righttitle_01");
break;
case 7:
setText("Sky Mountain", "T_lefttitle_01");
- setText("Starry Skies", "T_righttitle_01")l
+ setText("Starry Skies", "T_righttitle_01");
break;
case 8:
setText("Koopa Planet", "T_lefttitle_01");
- setText("Koopa Core", "T_righttitle_01")l
+ setText("Koopa Core", "T_righttitle_01");
break;
case 9:
setText("Bonus Land", "T_lefttitle_01");
- setText("Bonus Land", "T_righttitle_01")l
+ setText("Bonus Land", "T_righttitle_01");
break;
case 10:
setText("Goldwood Forest", "T_lefttitle_01");
- setText(" ", "T_righttitle_01")l
+ setText(" ", "T_righttitle_01");
// if ((level < 6) || (level == 33) || (level == 34))
// setWorldText("Goldwood\nForest");
@@ -417,7 +424,7 @@ void dWMStarCoin::setWorldName(int world) {
default:
setText("Unknown World", "T_lefttitle_01");
- setText("Unknown World", "T_righttitle_01")l
+ setText("Unknown World", "T_righttitle_01");
break;
}
diff --git a/src/koopatlas/starcoin.h b/src/koopatlas/starcoin.h
index 500ffa6..844b1ef 100644
--- a/src/koopatlas/starcoin.h
+++ b/src/koopatlas/starcoin.h
@@ -1,9 +1,9 @@
-#ifndef __KOOPATLAS_HUD_H
-#define __KOOPATLAS_HUD_H
+#ifndef __KOOPATLAS_STARCOIN_H
+#define __KOOPATLAS_STARCOIN_H
#include "koopatlas/core.h"
-class dWMStarCoin : public dBase_c {
+class dWMStarCoin : public dActor_c {
public:
dWMStarCoin();