Skip to content

Commit

Permalink
Extreme Galakong hack - switch palette and adjust title
Browse files Browse the repository at this point in the history
  • Loading branch information
10yard committed Jul 12, 2022
1 parent 7c1d901 commit 7d153c7
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build_version.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set version=v1.1
set version=v1.2

set zip_path="C:\Program Files\7-Zip\7z"
del releases\galakong_plugin_%version%.zip
Expand Down
57 changes: 47 additions & 10 deletions galakong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
-- SET GALAKONG_NOSTARS=1
-- SET GALAKONG_NOEXPLOSIONS=1
--
-- The hack becomes "Extreme Galakong" when used in combination with the "Wild Barrel Hack" rom.
--
-- Minimum start up arguments:
-- mame dkong -plugin galakong
-----------------------------------------------------------------------------------------
Expand Down Expand Up @@ -60,6 +62,7 @@ function galakong.startplugin()
local howhigh_ready = false
local end_of_level = false
local dead = false
local extreme = false
local name_entry = 0

local score = "000000"
Expand Down Expand Up @@ -177,6 +180,13 @@ function galakong.startplugin()
" + +",
" ++"}

local extreme_logo_table = {
"!! ! ! !!! !! !! !!! !!",
"! ! ! ! ! ! ! ! ! ! !",
"!! ! ! !! !! ! ! ! !!",
"! ! ! ! ! ! ! ! ! ! !",
"!! ! ! ! ! ! !! ! ! ! !!"}

local explode1_table = {
"",
"",
Expand Down Expand Up @@ -326,9 +336,9 @@ function galakong.startplugin()
-- Position of shield pickup by stage number
local pickup_table = {}
pickup_table[1] = {15, 212}
pickup_table[2] = {8, 208}
pickup_table[2] = {8, 161}
pickup_table[3] = {121, 73}
pickup_table[4] = {8, 192}
pickup_table[4] = {8, 161}

-- Point scored for multiple missile hits and associated sprite display
local bonus_table = {}
Expand Down Expand Up @@ -411,6 +421,12 @@ function galakong.startplugin()
s_cpu = mac.devices[":soundcpu"]
s_mem = s_cpu.spaces["data"]

-- Is this the wild barrel hack (i.e. extreme galakong)? Offset 3FBA to 3FBF is not used in regular DK
if emu.romname() == "dkong" and mem:read_direct_u32(0x3fba) == 0xc31977dd and mem:read_direct_u16(0x3fbe) == 0x2153 then
extreme = true
pickup_table[1] = {10, 96} -- easier pickup location on barrels
end

change_title()

--Generate a starfield
Expand All @@ -433,12 +449,7 @@ function galakong.startplugin()

--Add more delay to the GAME OVER screen
mem:write_direct_u8(0x132f, 0xff)

-- Is this the wild barrel hack? Offset 3FBA to 3FBF is not used in regular DK
if emu.romname() == "dkong" and mem:read_direct_u32(0x3fba) == 0xc31977dd and mem:read_direct_u16(0x3fbe) == 0x2153 then
pickup_table[1] = {10, 5} -- make pickup location easier on barrels
end


-- Donkey Kong Junior specific initialisation
if emu.romname() == "dkongjr" then
enemy_table =
Expand Down Expand Up @@ -480,6 +491,24 @@ function galakong.startplugin()
local left, right, fire
local _frame = scr:frame_number()

if extreme then
-- Adjust start level for extreme Galakong
if level == 1 then
mem:write_u8(0x6229, 5) -- update to level 5
mem:write_u16(0x622a, 0x3a73) -- update screen sequence
end
-- Switch palette for extreme Galakong
if stage == 1 then -- Girders
mem:write_u8(0xc7d86, 1)
mem:write_u8(0xc7d87, 0)
elseif stage == 2 then -- Pies/Conveyors
mem:write_u8(0xc7d86, 0)
mem:write_u8(0xc7d87, 1)
elseif stage == 4 then -- Rivets
mem:write_u8(0xc7d86, 0)
end
end

if mode2 == 0x1 then -- Initial screen
started = false

Expand All @@ -499,6 +528,10 @@ function galakong.startplugin()
draw_graphic(yard_logo_table, 19, 175)
write_ram_message(0x77be, " VERSION "..exports.version)

if extreme then
draw_graphic(extreme_logo_table, 224, 59)
end

-- Alternative coin entry sound
if mem:read_u8(0x6083) == 2 then
clear_sounds()
Expand Down Expand Up @@ -576,7 +609,7 @@ function galakong.startplugin()
if mode2 >= 0xb and mode2 <= 0xd then -- during gameplay
jumpman_x = mem:read_u8(0x6203) - 15
jumpman_y = mem:read_u8(0x6205)

if pickup then
-- shield was collected, the ship can now be controlled
left, right, fire = get_inputs()
Expand Down Expand Up @@ -1048,7 +1081,11 @@ function galakong.startplugin()
-- change "HIGH SCORE" to "DK SHOOTER"
-- HIGH SCORE is 10 characters, pad with space if necessary
-- 1234567890
write_rom_message(0x36b4," GALAKONG ")
if extreme then
write_rom_message(0x36b4,"X-GALAKONG")
else
write_rom_message(0x36b4," GALAKONG ")
end

-- Change "HOW HIGH CAN YOU GET" text in rom to "HOW UP CAN YOU SCHMUP ?"
-- how high is 23 characters, pad with space if necessary
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ You can disable some features by setting environmental variables before you laun

```SET GALAKONG_NOEXPLOSIONS=1```

The hack becomes "Extreme Galakong" when used in combination with the "Wild Barrel Hack" rom.


## Installing and running

Expand Down

0 comments on commit 7d153c7

Please sign in to comment.