From e12b1713576544fdda756a3ca8831642562ea921 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 27 Mar 2012 21:37:54 +0200 Subject: brought Koopatlas engine up to date and compiling --- src/koopatlas/map.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/koopatlas/map.cpp') diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index 258cf7c..5e2b813 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -41,8 +41,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; -- cgit v1.2.3 From 053170b827defd19db852a9caa647c9a469e417b Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 28 Mar 2012 01:23:46 +0200 Subject: fixes to WM code, and mHeap namespace --- src/koopatlas/map.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/koopatlas/map.cpp') diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index 5e2b813..fa5c120 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; -- cgit v1.2.3 From fc3975a42b30566bb542cb06bbd5f7c2da90f79a Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 28 Mar 2012 04:41:23 +0200 Subject: support for optimised tilesets --- src/koopatlas/map.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/koopatlas/map.cpp') diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index fa5c120..f4b953c 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -142,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); @@ -249,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(); } } -- cgit v1.2.3