diff options
Diffstat (limited to '')
-rwxr-xr-x | include/game.h | 1 | ||||
-rw-r--r-- | kamek_ntsc.x | 1 | ||||
-rw-r--r-- | kamek_ntsc2.x | 1 | ||||
-rw-r--r-- | kamek_pal.x | 1 | ||||
-rw-r--r-- | kamek_pal2.x | 1 | ||||
-rw-r--r-- | randtilegen.rb | 48 | ||||
-rw-r--r-- | randtiles.yaml | 5 | ||||
-rw-r--r-- | src/randtiles.cpp | 5 |
8 files changed, 58 insertions, 5 deletions
diff --git a/include/game.h b/include/game.h index 3c631c6..554e17a 100755 --- a/include/game.h +++ b/include/game.h @@ -41,6 +41,7 @@ void *DVD_GetFile(void *dvdclass2, const char *arc, const char *file); void *DVD_GetFile(void *dvdclass2, const char *arc, const char *file, u32 *length);
int MakeRandomNumber(int count);
+int MakeRandomNumberForTiles(int count);
extern int Player_Active[4];
diff --git a/kamek_ntsc.x b/kamek_ntsc.x index da5f3dd..6724759 100644 --- a/kamek_ntsc.x +++ b/kamek_ntsc.x @@ -1004,6 +1004,7 @@ SECTIONS { RandomSeed = 0x80429F44; MakeRandomNumber__Fi = 0x800B2EE0; + MakeRandomNumberForTiles__Fi = 0x801613A0; StrangeReplayValue1 = 0x8042792E; StrangeReplayValue2 = 0x80429D69; diff --git a/kamek_ntsc2.x b/kamek_ntsc2.x index 5fc9d3b..e3b3bce 100644 --- a/kamek_ntsc2.x +++ b/kamek_ntsc2.x @@ -1004,6 +1004,7 @@ SECTIONS { RandomSeed = 0x80429F44; MakeRandomNumber__Fi = 0x800B2EE0; + MakeRandomNumberForTiles__Fi = 0x801613A0; StrangeReplayValue1 = 0x8042792E; StrangeReplayValue2 = 0x80429D69; diff --git a/kamek_pal.x b/kamek_pal.x index c7a2fb7..e535d2a 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1004,6 +1004,7 @@ SECTIONS { RandomSeed = 0x8042A224;
MakeRandomNumber__Fi = 0x800B2EE0;
+ MakeRandomNumberForTiles__Fi = 0x801614E0;
StrangeReplayValue1 = 0x80427C2E;
StrangeReplayValue2 = 0x8042A049;
diff --git a/kamek_pal2.x b/kamek_pal2.x index 8e1321a..d6a3d40 100644 --- a/kamek_pal2.x +++ b/kamek_pal2.x @@ -1004,6 +1004,7 @@ SECTIONS { RandomSeed = 0xDEADBEEF; MakeRandomNumber__Fi = 0xDEADBEEF; + MakeRandomNumberForTiles__Fi = 0xDEADBEEF; StrangeReplayValue1 = 0xDEADBEEF; StrangeReplayValue2 = 0xDEADBEEF; diff --git a/randtilegen.rb b/randtilegen.rb index f77d333..f92db5d 100644 --- a/randtilegen.rb +++ b/randtilegen.rb @@ -11,9 +11,19 @@ class RandTileGenerator end def random(range, type=:both, numbers=nil) - numbers = range if numbers.nil? - - @current_section[:entries] << {range: range, type: type, numbers: numbers.to_a} + case range + when Range + # Regular handling + numbers = range if numbers.nil? + @current_section[:entries] << {range: range, type: type, numbers: numbers.to_a} + when Numeric + # One number + random(range..range, type, numbers) + when Enumerable + # An array or something else similar + numbers = range if numbers.nil? + range.each { |r| random(r, type, numbers) } + end end def pack @@ -79,6 +89,33 @@ class RandTileGenerator output << "\0" output.join end + + + def regular_terrain + # Left Side + random([0x10, 0x20, 0x30, 0x40], :vert) + # Right Side + random([0x11, 0x21, 0x31, 0x41], :vert) + # Top Side + random(2..7, :horz) + # Bottom Side + random(0x22..0x27, :horz) + # Middle + random(0x12..0x17) + end + + def sub_terrain + # Left Side + random([0x18, 0x28, 0x38, 0x48], :vert) + # Right Side + random([0x19, 0x29, 0x39, 0x49], :vert) + # Top Side + random(0xA..0xF, :horz) + # Bottom Side + random(0x2A..0x2F, :horz) + # Middle + random(0x1A..0x1F) + end end @@ -89,6 +126,11 @@ g.section('TestTileset') do g.random(250..255, :vert, 0..5) end +g.section('Pa1_nohara') do + g.regular_terrain + g.sub_terrain +end + File.open('/home/me/Games/Newer/DolphinPatch/NewerRes/RandTiles.bin', 'wb') do |f| f.write g.pack end diff --git a/randtiles.yaml b/randtiles.yaml index 5ee73aa..5bdc11c 100644 --- a/randtiles.yaml +++ b/randtiles.yaml @@ -24,3 +24,8 @@ hooks: src_addr_pal: 0x80086B48 target_func: 'TryAndRandomise' + - name: AHackOfGiganticProportions + type: patch + addr_pal: 0x80086B4C + data: '4800 0120' + diff --git a/src/randtiles.cpp b/src/randtiles.cpp index 4af3bf7..92e31ae 100644 --- a/src/randtiles.cpp +++ b/src/randtiles.cpp @@ -109,7 +109,7 @@ extern "C" void TryAndRandomise(RTilemapClass *self, BGRender *bgr) { // Found it!!
// Try to make one until we meet the conditions
u8 *tileNums = entry->getTileNums();
- u8 chosen = 0xFF;
+ u16 chosen = 0xFF;
u16 *top = 0, *left = 0, *right = 0, *bottom = 0;
if (entry->type == RandomTileData::CHECK_HORZ || entry->type == RandomTileData::CHECK_BOTH) {
@@ -123,7 +123,8 @@ extern "C" void TryAndRandomise(RTilemapClass *self, BGRender *bgr) { }
while (true) {
- chosen = tileNums[MakeRandomNumber(entry->count)];
+ // is there even a point to using that special random function?
+ chosen = (tileset << 8) | tileNums[MakeRandomNumberForTiles(entry->count)];
if (top != 0 && *top == chosen)
continue;
|