mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
give/take coins action of blue/red space (#22)
This commit is contained in:
parent
4859b524b3
commit
28bd777632
@ -15,6 +15,7 @@ DEF MAP_LOCATION rb ; 5
|
|||||||
DEF MAP_MUSIC rb ; 6
|
DEF MAP_MUSIC rb ; 6
|
||||||
DEF MAP_PALETTE rb ; 7
|
DEF MAP_PALETTE rb ; 7
|
||||||
DEF MAP_FISHGROUP rb ; 8
|
DEF MAP_FISHGROUP rb ; 8
|
||||||
|
DEF MAP_BASECOINS rb ; 9
|
||||||
DEF MAP_LENGTH EQU _RS
|
DEF MAP_LENGTH EQU _RS
|
||||||
|
|
||||||
; map environments (wEnvironment)
|
; map environments (wEnvironment)
|
||||||
|
@ -35,10 +35,11 @@ DEF NOON_HOUR EQU 12 ; 12 PM
|
|||||||
DEF MAX_DAYS EQU 36 * 7 ; 252
|
DEF MAX_DAYS EQU 36 * 7 ; 252
|
||||||
|
|
||||||
; significant coins values
|
; significant coins values
|
||||||
DEF START_COINS EQU 3000
|
DEF START_COINS EQU 100
|
||||||
DEF MOM_COINS EQU 2300
|
DEF MOM_COINS EQU 2300
|
||||||
DEF MAX_COINS EQU 999999
|
DEF MAX_COINS EQU 999999
|
||||||
DEF MAX_CHIPS EQU 9999
|
DEF MAX_LEVEL_COINS EQU 99999
|
||||||
|
DEF MAX_CHIPS EQU 9999
|
||||||
|
|
||||||
; link record
|
; link record
|
||||||
DEF MAX_LINK_RECORD EQU 9999
|
DEF MAX_LINK_RECORD EQU 9999
|
||||||
|
@ -13,8 +13,9 @@ DEF STRING_BUFFER_LENGTH EQU 19
|
|||||||
|
|
||||||
; checkcoins/takecoins accounts
|
; checkcoins/takecoins accounts
|
||||||
const_def
|
const_def
|
||||||
const YOUR_COINS ; 0
|
const YOUR_COINS ; 0
|
||||||
const MOMS_COINS ; 1
|
const CUR_LEVEL_COINS ; 1
|
||||||
|
const MOMS_COINS ; 2
|
||||||
|
|
||||||
; checkcoins/checkchips return values
|
; checkcoins/checkchips return values
|
||||||
const_def
|
const_def
|
||||||
@ -22,6 +23,9 @@ DEF STRING_BUFFER_LENGTH EQU 19
|
|||||||
const HAVE_AMOUNT ; 1
|
const HAVE_AMOUNT ; 1
|
||||||
const HAVE_LESS ; 2
|
const HAVE_LESS ; 2
|
||||||
|
|
||||||
|
; givecoins/takecoins/checkcoins special amount values
|
||||||
|
DEF BLUE_RED_SPACE_COINS EQU $ffffff
|
||||||
|
|
||||||
; checkpokemail return values
|
; checkpokemail return values
|
||||||
const_def
|
const_def
|
||||||
const POKEMAIL_WRONG_MAIL ; 0
|
const POKEMAIL_WRONG_MAIL ; 0
|
||||||
|
@ -7,11 +7,13 @@ MACRO map
|
|||||||
;\6: phone service flag: TRUE to prevent phone calls
|
;\6: phone service flag: TRUE to prevent phone calls
|
||||||
;\7: time of day: a PALETTE_* constant
|
;\7: time of day: a PALETTE_* constant
|
||||||
;\8: fishing group: a FISHGROUP_* constant
|
;\8: fishing group: a FISHGROUP_* constant
|
||||||
|
;\9: base coins: 8-bit value
|
||||||
db BANK(\1_MapAttributes), \2, \3
|
db BANK(\1_MapAttributes), \2, \3
|
||||||
dw \1_MapAttributes
|
dw \1_MapAttributes
|
||||||
db \4, \5
|
db \4, \5
|
||||||
dn \6, \7
|
dn \6, \7
|
||||||
db \8
|
db \8
|
||||||
|
db \9
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
MapGroupPointers::
|
MapGroupPointers::
|
||||||
@ -30,8 +32,8 @@ endc
|
|||||||
|
|
||||||
MapGroup_Level1:
|
MapGroup_Level1:
|
||||||
table_width MAP_LENGTH, MapGroup_Level1
|
table_width MAP_LENGTH, MapGroup_Level1
|
||||||
map Level1_Map1, TILESET_PLAYERS_ROOM, INDOOR_BUILDING, LANDMARK_LEVEL_1, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_DAY, FISHGROUP_SHORE
|
map Level1_Map1, TILESET_PLAYERS_ROOM, INDOOR_BUILDING, LANDMARK_LEVEL_1, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_DAY, FISHGROUP_SHORE, 1
|
||||||
; map Level1_Map2, TILESET_CHAMPIONS_ROOM, INDOOR_CAVE, LANDMARK_LEVEL_2, MUSIC_GYM, TRUE, PALETTE_NITE | IN_DARKNESS, FISHGROUP_SHORE
|
; map Level1_Map2, TILESET_CHAMPIONS_ROOM, INDOOR_CAVE, LANDMARK_LEVEL_2, MUSIC_GYM, TRUE, PALETTE_NITE | IN_DARKNESS, FISHGROUP_SHORE, 1
|
||||||
assert_table_length NUM_LEVEL_1_MAPS
|
assert_table_length NUM_LEVEL_1_MAPS
|
||||||
|
|
||||||
; MapGroup_Level2:
|
; MapGroup_Level2:
|
||||||
@ -42,27 +44,27 @@ MapGroup_Level1:
|
|||||||
if DEF(_DEBUG)
|
if DEF(_DEBUG)
|
||||||
MapGroup_DebugLevel1:
|
MapGroup_DebugLevel1:
|
||||||
table_width MAP_LENGTH, MapGroup_DebugLevel1
|
table_width MAP_LENGTH, MapGroup_DebugLevel1
|
||||||
map DebugLevel1_Map1, TILESET_PLAYERS_ROOM, INDOOR_BUILDING, LANDMARK_DEBUGLEVEL_1, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_DAY, FISHGROUP_SHORE
|
map DebugLevel1_Map1, TILESET_PLAYERS_ROOM, INDOOR_BUILDING, LANDMARK_DEBUGLEVEL_1, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_DAY, FISHGROUP_SHORE, 1
|
||||||
assert_table_length NUM_DEBUGLEVEL_1_MAPS
|
assert_table_length NUM_DEBUGLEVEL_1_MAPS
|
||||||
|
|
||||||
MapGroup_DebugLevel2:
|
MapGroup_DebugLevel2:
|
||||||
table_width MAP_LENGTH, MapGroup_DebugLevel2
|
table_width MAP_LENGTH, MapGroup_DebugLevel2
|
||||||
map DebugLevel2_Map1, TILESET_BOARD_DEBUG_2, INDOOR_CAVE, LANDMARK_DEBUGLEVEL_2, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_NITE, FISHGROUP_SHORE
|
map DebugLevel2_Map1, TILESET_BOARD_DEBUG_2, INDOOR_CAVE, LANDMARK_DEBUGLEVEL_2, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_NITE, FISHGROUP_SHORE, 2
|
||||||
map DebugLevel2_Map2, TILESET_BOARD_DEBUG_2, INDOOR_CAVE, LANDMARK_DEBUGLEVEL_2, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_NITE, FISHGROUP_SHORE
|
map DebugLevel2_Map2, TILESET_BOARD_DEBUG_2, INDOOR_CAVE, LANDMARK_DEBUGLEVEL_2, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_NITE, FISHGROUP_SHORE, 2
|
||||||
assert_table_length NUM_DEBUGLEVEL_2_MAPS
|
assert_table_length NUM_DEBUGLEVEL_2_MAPS
|
||||||
|
|
||||||
MapGroup_DebugLevel3:
|
MapGroup_DebugLevel3:
|
||||||
table_width MAP_LENGTH, MapGroup_DebugLevel3
|
table_width MAP_LENGTH, MapGroup_DebugLevel3
|
||||||
map DebugLevel3_Map1, TILESET_FOREST, INDOOR_FOREST, LANDMARK_DEBUGLEVEL_3, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_AUTO, FISHGROUP_SHORE
|
map DebugLevel3_Map1, TILESET_FOREST, INDOOR_FOREST, LANDMARK_DEBUGLEVEL_3, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_AUTO, FISHGROUP_SHORE, 3
|
||||||
assert_table_length NUM_DEBUGLEVEL_3_MAPS
|
assert_table_length NUM_DEBUGLEVEL_3_MAPS
|
||||||
|
|
||||||
MapGroup_DebugLevel4:
|
MapGroup_DebugLevel4:
|
||||||
table_width MAP_LENGTH, MapGroup_DebugLevel4
|
table_width MAP_LENGTH, MapGroup_DebugLevel4
|
||||||
map DebugLevel4_Map1, TILESET_BOARD_DEBUG_1, OUTDOOR_GRASSY, LANDMARK_DEBUGLEVEL_4, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_AUTO, FISHGROUP_SHORE
|
map DebugLevel4_Map1, TILESET_BOARD_DEBUG_1, OUTDOOR_GRASSY, LANDMARK_DEBUGLEVEL_4, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_AUTO, FISHGROUP_SHORE, 4
|
||||||
assert_table_length NUM_DEBUGLEVEL_4_MAPS
|
assert_table_length NUM_DEBUGLEVEL_4_MAPS
|
||||||
|
|
||||||
MapGroup_DebugLevel5:
|
MapGroup_DebugLevel5:
|
||||||
table_width MAP_LENGTH, MapGroup_DebugLevel5
|
table_width MAP_LENGTH, MapGroup_DebugLevel5
|
||||||
map DebugLevel5_Map1, TILESET_BOARD_DEBUG_1, OUTDOOR_GRASSY, LANDMARK_DEBUGLEVEL_5, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_AUTO, FISHGROUP_SHORE
|
map DebugLevel5_Map1, TILESET_BOARD_DEBUG_1, OUTDOOR_GRASSY, LANDMARK_DEBUGLEVEL_5, MUSIC_NEW_BARK_TOWN, FALSE, PALETTE_AUTO, FISHGROUP_SHORE, 5
|
||||||
assert_table_length NUM_DEBUGLEVEL_5_MAPS
|
assert_table_length NUM_DEBUGLEVEL_5_MAPS
|
||||||
endc
|
endc
|
@ -4,6 +4,8 @@ BlueSpaceScript::
|
|||||||
scall ArriveToRegularSpaceScript
|
scall ArriveToRegularSpaceScript
|
||||||
iftrue .not_landed
|
iftrue .not_landed
|
||||||
scall LandedInRegularSpaceScript_BeforeSpaceEffect
|
scall LandedInRegularSpaceScript_BeforeSpaceEffect
|
||||||
|
givecoins CUR_LEVEL_COINS, BLUE_RED_SPACE_COINS
|
||||||
|
playsound SFX_TRANSACTION
|
||||||
scall LandedInRegularSpaceScript_AfterSpaceEffect
|
scall LandedInRegularSpaceScript_AfterSpaceEffect
|
||||||
.not_landed
|
.not_landed
|
||||||
end
|
end
|
||||||
@ -12,6 +14,8 @@ RedSpaceScript::
|
|||||||
scall ArriveToRegularSpaceScript
|
scall ArriveToRegularSpaceScript
|
||||||
iftrue .not_landed
|
iftrue .not_landed
|
||||||
scall LandedInRegularSpaceScript_BeforeSpaceEffect
|
scall LandedInRegularSpaceScript_BeforeSpaceEffect
|
||||||
|
takecoins CUR_LEVEL_COINS, BLUE_RED_SPACE_COINS
|
||||||
|
playsound SFX_TRANSACTION
|
||||||
scall LandedInRegularSpaceScript_AfterSpaceEffect
|
scall LandedInRegularSpaceScript_AfterSpaceEffect
|
||||||
.not_landed
|
.not_landed
|
||||||
end
|
end
|
||||||
@ -77,9 +81,7 @@ EndSpaceScript::
|
|||||||
GreySpaceScript::
|
GreySpaceScript::
|
||||||
scall ArriveToRegularSpaceScript
|
scall ArriveToRegularSpaceScript
|
||||||
iftrue .not_landed
|
iftrue .not_landed
|
||||||
wait 300
|
scall LandedInRegularSpaceScript_BeforeSpaceEffect
|
||||||
turnobject PLAYER, DOWN
|
|
||||||
wait 100
|
|
||||||
scall LandedInRegularSpaceScript_AfterSpaceEffect
|
scall LandedInRegularSpaceScript_AfterSpaceEffect
|
||||||
.not_landed
|
.not_landed
|
||||||
end
|
end
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
GiveCoins::
|
GiveCoins::
|
||||||
ld a, 3
|
ld a, 3
|
||||||
call AddCoins
|
call AddCoins
|
||||||
ld bc, MaxCoins
|
call LoadMaxCoins_bc
|
||||||
ld a, 3
|
ld a, 3
|
||||||
call CompareCoins
|
call CompareCoins
|
||||||
jr z, .not_maxed_out
|
jr z, .not_maxed_out
|
||||||
jr c, .not_maxed_out
|
jr c, .not_maxed_out
|
||||||
ld hl, MaxCoins
|
call LoadMaxCoins_hl
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
@ -22,9 +22,26 @@ GiveCoins::
|
|||||||
and a
|
and a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
LoadMaxCoins_bc:
|
||||||
|
ld a, d
|
||||||
|
cp HIGH(wCurLevelCoins)
|
||||||
|
ld bc, MaxCurLevelCoins ; CUR_LEVEL_COINS
|
||||||
|
ret z
|
||||||
|
ld bc, MaxCoins ; YOUR_COINS or MOMS_COINS
|
||||||
|
ret
|
||||||
|
|
||||||
|
LoadMaxCoins_hl:
|
||||||
|
call LoadMaxCoins_bc
|
||||||
|
ld h, b
|
||||||
|
ld l, c
|
||||||
|
ret
|
||||||
|
|
||||||
MaxCoins:
|
MaxCoins:
|
||||||
dt MAX_COINS
|
dt MAX_COINS
|
||||||
|
|
||||||
|
MaxCurLevelCoins:
|
||||||
|
dt MAX_LEVEL_COINS
|
||||||
|
|
||||||
TakeCoins::
|
TakeCoins::
|
||||||
ld a, 3
|
ld a, 3
|
||||||
call SubtractCoins
|
call SubtractCoins
|
||||||
|
@ -153,8 +153,15 @@ StartMap:
|
|||||||
|
|
||||||
; initialize board state
|
; initialize board state
|
||||||
xor a
|
xor a
|
||||||
ld [wCurTurn], a
|
ld hl, wCurTurn
|
||||||
ld [wCurSpace], a
|
ld [hli], a ; wCurTurn
|
||||||
|
ld [hli], a ; wCurSpace
|
||||||
|
ld [hli], a ; wCurLevelCoins
|
||||||
|
ld [hli], a ;
|
||||||
|
ld [hli], a ;
|
||||||
|
ld [hli], a ; wCurLevelExp
|
||||||
|
ld [hli], a ;
|
||||||
|
ld [hl], a ;
|
||||||
|
|
||||||
; initialize overworld state
|
; initialize overworld state
|
||||||
ld hl, wNextWarp
|
ld hl, wNextWarp
|
||||||
|
@ -1874,13 +1874,18 @@ GetCoinsAccount:
|
|||||||
and a
|
and a
|
||||||
ld de, wCoins ; YOUR_COINS
|
ld de, wCoins ; YOUR_COINS
|
||||||
ret z
|
ret z
|
||||||
|
dec a
|
||||||
|
ld de, wCurLevelCoins ; CUR_LEVEL_COINS
|
||||||
|
ret z
|
||||||
ld de, wMomsCoins ; MOMS_COINS
|
ld de, wMomsCoins ; MOMS_COINS
|
||||||
ret
|
ret
|
||||||
|
|
||||||
LoadCoinsAmountToMem:
|
LoadCoinsAmountToMem:
|
||||||
ld bc, hCoinsTemp
|
ld bc, hCoinsTemp
|
||||||
push bc
|
|
||||||
call GetScriptByte
|
call GetScriptByte
|
||||||
|
cp HIGH(BLUE_RED_SPACE_COINS)
|
||||||
|
jr z, .blue_red_space_coins
|
||||||
|
push bc
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
inc bc
|
inc bc
|
||||||
call GetScriptByte
|
call GetScriptByte
|
||||||
@ -1891,6 +1896,38 @@ LoadCoinsAmountToMem:
|
|||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.blue_red_space_coins
|
||||||
|
push de
|
||||||
|
call GetScriptByte
|
||||||
|
call GetScriptByte
|
||||||
|
; return [hCoinsTemp] = MAP_BASECOINS * [wDieRoll]
|
||||||
|
ld de, MAP_BASECOINS
|
||||||
|
call GetMapField
|
||||||
|
ld a, [wDieRoll]
|
||||||
|
dec a
|
||||||
|
ld e, a
|
||||||
|
ld a, c
|
||||||
|
ld b, 0 ; c = ba = MAP_BASECOINS
|
||||||
|
jr z, .go
|
||||||
|
.loop
|
||||||
|
add c
|
||||||
|
jr nc, .ok
|
||||||
|
inc b
|
||||||
|
.ok
|
||||||
|
dec e
|
||||||
|
jr nz, .loop
|
||||||
|
.go
|
||||||
|
; ba = MAP_BASECOINS * [wDieRoll]
|
||||||
|
ld hl, hCoinsTemp + 2
|
||||||
|
ld [hld], a
|
||||||
|
ld a, b
|
||||||
|
ld [hld], a
|
||||||
|
xor a
|
||||||
|
ld [hl], a
|
||||||
|
ld bc, hCoinsTemp
|
||||||
|
pop de
|
||||||
|
ret
|
||||||
|
|
||||||
Script_givechips:
|
Script_givechips:
|
||||||
call LoadChipAmountToMem
|
call LoadChipAmountToMem
|
||||||
farcall GiveChips
|
farcall GiveChips
|
||||||
@ -1904,7 +1941,7 @@ Script_takechips:
|
|||||||
Script_checkchips:
|
Script_checkchips:
|
||||||
call LoadChipAmountToMem
|
call LoadChipAmountToMem
|
||||||
farcall CheckChips
|
farcall CheckChips
|
||||||
jr CompareCoinsAction
|
jp CompareCoinsAction
|
||||||
|
|
||||||
LoadChipAmountToMem:
|
LoadChipAmountToMem:
|
||||||
call GetScriptByte
|
call GetScriptByte
|
||||||
|
@ -2548,6 +2548,8 @@ wScreenSave:: ds SCREEN_META_WIDTH * SCREEN_META_HEIGHT
|
|||||||
|
|
||||||
wCurTurn:: db
|
wCurTurn:: db
|
||||||
wCurSpace:: db
|
wCurSpace:: db
|
||||||
|
wCurLevelCoins:: ds 3
|
||||||
|
wCurLevelExp:: ds 3
|
||||||
|
|
||||||
wCurSpaceStruct:: space_struct wCurSpace
|
wCurSpaceStruct:: space_struct wCurSpace
|
||||||
wCurSpaceStructEnd::
|
wCurSpaceStructEnd::
|
||||||
@ -2646,6 +2648,8 @@ wMagikarpRecordHoldersName:: ds NAME_LENGTH
|
|||||||
wPokemonDataEnd::
|
wPokemonDataEnd::
|
||||||
wGameDataEnd::
|
wGameDataEnd::
|
||||||
|
|
||||||
|
; requirement of GiveCoins
|
||||||
|
assert HIGH(wCoins) != HIGH(wCurLevelCoins)
|
||||||
|
|
||||||
SECTION "Pic Animations", WRAMX
|
SECTION "Pic Animations", WRAMX
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user