From d1293da8dc5aeba5877899621145e3ca55244a52 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 15 Sep 2020 01:27:24 +0200 Subject: [PATCH] - connecting the dots for Blood's special tile features. --- source/blood/src/blood.h | 1 + source/blood/src/tile.cpp | 7 +++++++ source/core/gamestruct.h | 1 + source/core/textures/buildtiles.cpp | 11 ++--------- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index 776675dcf..433c9ddd1 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -98,6 +98,7 @@ struct GameInterface : ::GameInterface void NextLevel(MapRecord* map, int skill) override; void LevelCompleted(MapRecord* map, int skill) override; bool DrawAutomapPlayer(int x, int y, int z, int a) override; + void SetTileProps(int til, int surf, int vox, int shade) override; GameStats getStats() override; }; diff --git a/source/blood/src/tile.cpp b/source/blood/src/tile.cpp index 0f787b026..94ceb86a3 100644 --- a/source/blood/src/tile.cpp +++ b/source/blood/src/tile.cpp @@ -128,4 +128,11 @@ char tileGetSurfType(int hit) return 0; } +void GameInterface::SetTileProps(int tile, int surf, int vox, int shade) +{ + if (surf != INT_MAX) surfType[tile] = surf; + if (vox != INT_MAX) voxelIndex[tile] = vox; + if (shade != INT_MAX) tileShade[tile] = shade; +} + END_BLD_NS diff --git a/source/core/gamestruct.h b/source/core/gamestruct.h index 67a8226d8..91aa9e9af 100644 --- a/source/core/gamestruct.h +++ b/source/core/gamestruct.h @@ -107,6 +107,7 @@ struct GameInterface virtual void NewGame(MapRecord* map, int skill) {} virtual void LevelCompleted(MapRecord* map, int skill) {} virtual bool DrawAutomapPlayer(int x, int y, int z, int a) { return false; } + virtual void SetTileProps(int tile, int surf, int vox, int shade) {} virtual FString statFPS() { diff --git a/source/core/textures/buildtiles.cpp b/source/core/textures/buildtiles.cpp index fa14aa449..c4c36bed3 100644 --- a/source/core/textures/buildtiles.cpp +++ b/source/core/textures/buildtiles.cpp @@ -46,6 +46,7 @@ #include "texturemanager.h" #include "c_dispatch.h" #include "sc_man.h" +#include "gamestruct.h" enum { @@ -1099,15 +1100,7 @@ void tileImport(FScriptPosition& pos, TileImport& imp) pos.Message(MSG_DEBUGMSG, "Size mismatch for tile %d", imp.tile); return; } -#if 0 - // fixme - forward to the game code. These are Blood specific. - if (imp.havesurface) - ;// gi->SetSurfType(tile, surface); - if (imp.havevox) - ;// gi->SetVoxel(tile, vox); - if (imp.haveshade) - ;// gi->SetShade(tile, shade); -#endif + gi->SetTileProps(imp.tile, imp.surface, imp.vox, imp.shade); if (imp.fn.IsNotEmpty() && tileImportFromTexture(imp.fn, imp.tile, imp.alphacut, imp.istexture) < 0) return;