diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-03-29 11:11:11 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-03-29 11:11:11 -0500 |
commit | 2e5153002bccc3722dbacaa62b729493d2c2bf89 (patch) | |
tree | 0d235a689a0d7c831293dff206833f2d8efb277a /src/koopatlas | |
parent | 128ab59a90b26c54e18f8823adc26d37115fb5f5 (diff) | |
parent | 7bbab722a388bc63ec195a48c22c7060e3fab999 (diff) | |
download | kamek-2e5153002bccc3722dbacaa62b729493d2c2bf89.tar.gz kamek-2e5153002bccc3722dbacaa62b729493d2c2bf89.zip |
merging changes to latest pull
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/camera.cpp | 8 | ||||
-rw-r--r-- | src/koopatlas/core.cpp | 4 | ||||
-rw-r--r-- | src/koopatlas/core.h | 4 | ||||
-rw-r--r-- | src/koopatlas/map.cpp | 36 | ||||
-rw-r--r-- | src/koopatlas/mapdata.cpp | 2 |
5 files changed, 36 insertions, 18 deletions
diff --git a/src/koopatlas/camera.cpp b/src/koopatlas/camera.cpp index 47b68a5..c13db56 100644 --- a/src/koopatlas/camera.cpp +++ b/src/koopatlas/camera.cpp @@ -69,7 +69,7 @@ int dWorldCamera_c::onExecute() { int heldButtons = Remocon_GetButtons(GetActiveRemocon()); if (heldButtons & WPAD_MINUS) { bool change = false; - if (heldButtons & WPAD_LEFT) { + /*if (heldButtons & WPAD_LEFT) { currentX -= 8.0f; change = true; } @@ -84,7 +84,7 @@ int dWorldCamera_c::onExecute() { if (heldButtons & WPAD_DOWN) { currentY -= 8.0f; change = true; - } + }*/ if (heldButtons & WPAD_B) { zoomLevel -= 0.10f; change = true; @@ -96,6 +96,10 @@ int dWorldCamera_c::onExecute() { if (change) { } } + daWMPlayer_c *player = daWMPlayer_c::instance; + currentX = player->pos.x; + currentY = player->pos.y; + calculateScreenGeometry(); doStuff(10000.0); generateCameraMatrices(); diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index f7acf00..5e15d99 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -175,6 +175,7 @@ bool WMInit_LoadResources2(void *ptr) { wm->mapPath = wm->getMapNameForIndex(wm->currentMapID); if (wm->mapPath == 0) wm->mapPath = wm->getMapNameForIndex(0); + OSReport("Load map: %s\n", wm->mapPath); } return wm->mapData.load(wm->mapPath); @@ -229,7 +230,7 @@ bool WMInit_SetupExtra(void *ptr) { wm->player->modelHandler->mdlClass->startAnimation(0, 1.2f, 10.0f, 0.0f); dKPNode_s *cNode = wm->pathManager.currentNode; - wm->player->pos = (Vec){cNode->x, -cNode->y, wm->player->pos.y}; + wm->player->pos = (Vec){cNode->x, -cNode->y, wm->player->pos.z}; // is last param correct? must check :/ wm->map = (dWMMap_c*)CreateParentedObject(WM_MAP, wm, 0, 0); @@ -857,6 +858,7 @@ u32 dScKoopatlas_c::iterateMapList(u32(*callback)(u32,const char *,int,int), u32 while (true) { u8 chr = *ptr; if (chr == 13) { + *ptr = 0; ++ptr; continue; } diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 6a76cc4..fc517b2 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -19,13 +19,13 @@ #ifdef WM_DEBUGGING #define MapReport OSReport #else -inline void MapReport(const char *str, ...) { } +#define MapReport(...) #endif #ifdef WM_SPAMMY_DEBUGGING #define SpammyReport OSReport #else -inline void SpammyReport(const char *str, ...) { } +#define SpammyReport(...) #endif void NewerMapDrawFunc(); diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index 4b90cb7..f4b953c 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -6,18 +6,21 @@ //#define DOODAD_DEBUGGING #ifdef TILE_DEBUGGING +#define TileReport OSReport #else -inline void TileReport(const char *str, ...) { } +#define TileReport(...) #endif #ifdef BOUND_DEBUGGING +#define BoundReport OSReport #else -inline void BoundReport(const char *str, ...) { } +#define BoundReport(...) #endif #ifdef DOODAD_DEBUGGING +#define DoodadReport OSReport #else -inline void DoodadReport(const char *str, ...) { } +#define DoodadReport(...) #endif dWMMap_c *dWMMap_c::instance = 0; @@ -41,8 +44,6 @@ dWMMap_c::dWMMap_c() { int dWMMap_c::onCreate() { renderer.allocator.setup(GameHeaps[0], 0x20); bool result = renderer.setup(&renderer.allocator); - // if (result) - // else bgMatrix.translation(1140.0f, -2910.0f, -500.0f); s16 rot = 0x4000; @@ -141,9 +142,11 @@ void dWMMap_c::renderer_c::beginRendering() { GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + // Tiles GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_S16, 0); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_U8, 8); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); + // Doodads GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_POS, GX_POS_XY, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT1, GX_VA_TEX0, GX_TEX_ST, GX_U8, 8); @@ -248,19 +251,28 @@ void dWMMap_c::renderer_c::renderTileLayer(dKPLayer_s *layer, dKPLayer_s::sector s16 worldX = (worldSectorX | inX) * 24; s16 worldY = -((worldSectorY | inY) * 24); - u8 tileX = (tileID & 0x1F) * 8; - u8 tileY = ((tileID & 0x1E0) / 32) * 16; TileReport("Drawing tile %d at %d,%d\n", tileID, worldX, worldY); + + float tileX = (float)((tileID & 0x1F) * 28); + float tileY = (float)(((tileID & 0x1E0) >> 5) * 28); + + float xMult = (1.0f / 896.0f); + float yMult = (1.0f / 448.0f); + + float coordX1 = xMult * (tileX + 2.0f); + float coordX2 = xMult * (tileX + 26.0f); + float coordY1 = yMult * (tileY + 2.0f); + float coordY2 = yMult * (tileY + 26.0f); GXBegin(GX_QUADS, GX_VTXFMT0, 4); GXPosition2s16(worldX + 24, worldY - 24); - GXTexCoord2u8(tileX + 7, tileY + 14); + GXTexCoord2f32(coordX2, coordY2); GXPosition2s16(worldX + 24, worldY); - GXTexCoord2u8(tileX + 7, tileY + 2); + GXTexCoord2f32(coordX2, coordY1); GXPosition2s16(worldX, worldY); - GXTexCoord2u8(tileX + 1, tileY + 2); + GXTexCoord2f32(coordX1, coordY1); GXPosition2s16(worldX, worldY - 24); - GXTexCoord2u8(tileX + 1, tileY + 14);//*/ + GXTexCoord2f32(coordX1, coordY2); GXEnd(); } } diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp index eaf9c75..6838741 100644 --- a/src/koopatlas/mapdata.cpp +++ b/src/koopatlas/mapdata.cpp @@ -40,7 +40,7 @@ dKPMapData_c::~dKPMapData_c() { } bool dKPMapData_c::load(const char *filename) { - data = (dKPMapFile_s*)m_fileLoader.load(filename); + data = (dKPMapFile_s*)m_fileLoader.load(filename, 0, mHeap::archiveHeap); if (data == 0) return false; |