NPC trade constants don't all just start with TRADE_

This commit is contained in:
Rangi 2018-01-31 21:16:57 -05:00
parent b04f41da98
commit 7d6e82ef1c
15 changed files with 109 additions and 107 deletions

View File

@ -33,7 +33,7 @@ INCLUDE "constants/mobile_constants.asm"
INCLUDE "constants/move_constants.asm"
INCLUDE "constants/move_effect_constants.asm"
INCLUDE "constants/music_constants.asm"
INCLUDE "constants/npctrade_constants.asm"
INCLUDE "constants/npc_trade_constants.asm"
INCLUDE "constants/phone_constants.asm"
INCLUDE "constants/pokemon_constants.asm"
INCLUDE "constants/pokemon_data_constants.asm"

View File

@ -0,0 +1,44 @@
; npctrade struct members (see data/events/npc_trades.asm)
NPCTRADE_DIALOG EQU 0 ; db
NPCTRADE_GIVEMON EQU 1 ; db
NPCTRADE_GETMON EQU 2 ; db
NPCTRADE_NICK EQU 3 ; ds MON_NAME_LENGTH
NPCTRADE_DVS EQU 14 ; dw
NPCTRADE_ITEM EQU 16 ; db
NPCTRADE_OT_ID EQU 17 ; dw
NPCTRADE_OT_NAME EQU 19 ; ds NAME_LENGTH
NPCTRADE_GENDER EQU 30 ; db
NPCTRADE_PADDING EQU 31 ; db
; NPCTrades indexes (see data/events/npc_trades.asm)
const_def
const NPC_TRADE_MIKE ; 0
const NPC_TRADE_KYLE ; 1
const NPC_TRADE_TIM ; 2
const NPC_TRADE_EMY ; 3
const NPC_TRADE_CHRIS ; 4
const NPC_TRADE_KIM ; 5
const NPC_TRADE_FOREST ; 6
; trade gender limits
const_def
const TRADE_GENDER_EITHER
const TRADE_GENDER_MALE
const TRADE_GENDER_FEMALE
; TradeTexts indexes (see engine/events/npc_trade.asm)
; trade dialogs
const_def
const TRADE_DIALOG_INTRO
const TRADE_DIALOG_CANCEL
const TRADE_DIALOG_WRONG
const TRADE_DIALOG_COMPLETE
const TRADE_DIALOG_AFTER
; trade dialog sets
const_def
const TRADE_DIALOGSET_COLLECTOR
const TRADE_DIALOGSET_HAPPY
const TRADE_DIALOGSET_NEWBIE
const TRADE_DIALOGSET_GIRL

View File

@ -1,43 +0,0 @@
; npctrade struct members (see data/events/npc_trades.asm)
TRADE_DIALOG EQU 0
TRADE_GIVEMON EQU 1
TRADE_GETMON EQU 2
TRADE_NICK EQU 3
TRADE_DVS EQU 14
TRADE_ITEM EQU 16
TRADE_OT_ID EQU 17
TRADE_OT_NAME EQU 19
TRADE_GENDER EQU 30
TRADE_PADDING EQU 31
; NPCTrades indexes (see data/events/npc_trades.asm)
const_def
const NPCTRADE_MIKE ; 0
const NPCTRADE_KYLE ; 1
const NPCTRADE_TIM ; 2
const NPCTRADE_EMY ; 3
const NPCTRADE_CHRIS ; 4
const NPCTRADE_KIM ; 5
const NPCTRADE_FOREST ; 6
; trade gender limits
TRADE_EITHER_GENDER EQU 0
TRADE_MALE_ONLY EQU 1
TRADE_FEMALE_ONLY EQU 2
; TradeTexts indexes (see engine/npctrade.asm)
; trade dialogs
const_def
const TRADE_INTRO
const TRADE_CANCEL
const TRADE_WRONG
const TRADE_COMPLETE
const TRADE_AFTER
; trade dialog sets
const_def
const TRADE_DIALOG_COLLECTOR
const TRADE_DIALOG_HAPPY
const TRADE_DIALOG_NEWBIE
const TRADE_DIALOG_GIRL

View File

@ -91,6 +91,7 @@ RETVAR_EXECUTE EQU (2 << 6)
NUM_PLAYER_EVENTS EQU const_value
; bg_event types
; TryBGEvent arguments (see engine/events.asm)
const_def
const BGEVENT_READ

View File

@ -8,11 +8,11 @@ ENDM
NPCTrades: ; fce58
; entries correspond to NPCTRADE_* constants
npctrade TRADE_DIALOG_COLLECTOR, ABRA, MACHOP, "MUSCLE@@@@@", $37, $66, GOLD_BERRY, 37460, "MIKE@@@@@@@", TRADE_EITHER_GENDER
npctrade TRADE_DIALOG_COLLECTOR, BELLSPROUT, ONIX, "ROCKY@@@@@@", $96, $66, BITTER_BERRY, 48926, "KYLE@@@@@@@", TRADE_EITHER_GENDER
npctrade TRADE_DIALOG_HAPPY, KRABBY, VOLTORB, "VOLTY@@@@@@", $98, $88, PRZCUREBERRY, 29189, "TIM@@@@@@@@", TRADE_EITHER_GENDER
npctrade TRADE_DIALOG_GIRL, DRAGONAIR, DODRIO, "DORIS@@@@@@", $77, $66, SMOKE_BALL, 00283, "EMY@@@@@@@@", TRADE_FEMALE_ONLY
npctrade TRADE_DIALOG_NEWBIE, HAUNTER, XATU, "PAUL@@@@@@@", $96, $86, MYSTERYBERRY, 15616, "CHRIS@@@@@@", TRADE_EITHER_GENDER
npctrade TRADE_DIALOG_GIRL, CHANSEY, AERODACTYL, "AEROY@@@@@@", $96, $66, GOLD_BERRY, 26491, "KIM@@@@@@@@", TRADE_EITHER_GENDER
npctrade TRADE_DIALOG_COLLECTOR, DUGTRIO, MAGNETON, "MAGGIE@@@@@", $96, $66, METAL_COAT, 50082, "FOREST@@@@@", TRADE_EITHER_GENDER
npctrade TRADE_DIALOGSET_COLLECTOR, ABRA, MACHOP, "MUSCLE@@@@@", $37, $66, GOLD_BERRY, 37460, "MIKE@@@@@@@", TRADE_GENDER_EITHER
npctrade TRADE_DIALOGSET_COLLECTOR, BELLSPROUT, ONIX, "ROCKY@@@@@@", $96, $66, BITTER_BERRY, 48926, "KYLE@@@@@@@", TRADE_GENDER_EITHER
npctrade TRADE_DIALOGSET_HAPPY, KRABBY, VOLTORB, "VOLTY@@@@@@", $98, $88, PRZCUREBERRY, 29189, "TIM@@@@@@@@", TRADE_GENDER_EITHER
npctrade TRADE_DIALOGSET_GIRL, DRAGONAIR, DODRIO, "DORIS@@@@@@", $77, $66, SMOKE_BALL, 00283, "EMY@@@@@@@@", TRADE_GENDER_FEMALE
npctrade TRADE_DIALOGSET_NEWBIE, HAUNTER, XATU, "PAUL@@@@@@@", $96, $86, MYSTERYBERRY, 15616, "CHRIS@@@@@@", TRADE_GENDER_EITHER
npctrade TRADE_DIALOGSET_GIRL, CHANSEY, AERODACTYL, "AEROY@@@@@@", $96, $66, GOLD_BERRY, 26491, "KIM@@@@@@@@", TRADE_GENDER_EITHER
npctrade TRADE_DIALOGSET_COLLECTOR, DUGTRIO, MAGNETON, "MAGGIE@@@@@", $96, $66, METAL_COAT, 50082, "FOREST@@@@@", TRADE_GENDER_EITHER
; fcf38

View File

@ -4,31 +4,31 @@ NPCTrade:: ; fcba8
call Trade_GetDialog
ld b, CHECK_FLAG
call TradeFlagAction
ld a, TRADE_AFTER
ld a, TRADE_DIALOG_AFTER
jr nz, .done
ld a, TRADE_INTRO
ld a, TRADE_DIALOG_INTRO
call PrintTradeText
call YesNoBox
ld a, TRADE_CANCEL
ld a, TRADE_DIALOG_CANCEL
jr c, .done
; Select givemon from party
ld b, PARTYMENUACTION_GIVE_MON
farcall SelectTradeOrDayCareMon
ld a, TRADE_CANCEL
ld a, TRADE_DIALOG_CANCEL
jr c, .done
ld e, TRADE_GIVEMON
ld e, NPCTRADE_GIVEMON
call GetTradeAttribute
ld a, [CurPartySpecies]
cp [hl]
ld a, TRADE_WRONG
ld a, TRADE_DIALOG_WRONG
jr nz, .done
call CheckTradeGender
ld a, TRADE_WRONG
ld a, TRADE_DIALOG_WRONG
jr c, .done
ld b, SET_FLAG
@ -46,7 +46,7 @@ NPCTrade:: ; fcba8
call RestartMapMusic
ld a, TRADE_COMPLETE
ld a, TRADE_DIALOG_COMPLETE
.done
call PrintTradeText
@ -72,14 +72,14 @@ CheckTradeGender: ; fcc23
xor a
ld [MonType], a
ld e, TRADE_GENDER
ld e, NPCTRADE_GENDER
call GetTradeAttribute
ld a, [hl]
and a ; TRADE_EITHER_GENDER
and a ; TRADE_GENDER_EITHER
jr z, .matching
cp TRADE_MALE_ONLY
cp TRADE_GENDER_MALE
jr z, .check_male
; TRADE_GENDER_FEMALE
farcall GetGender
jr nz, .not_matching
jr .matching
@ -108,7 +108,7 @@ TradeFlagAction: ; fcc4a
; fcc59
Trade_GetDialog: ; fcc59
ld e, TRADE_DIALOG
ld e, NPCTRADE_DIALOG
call GetTradeAttribute
ld a, [hl]
ld [wcf64], a
@ -116,12 +116,12 @@ Trade_GetDialog: ; fcc59
; fcc63
DoNPCTrade: ; fcc63
ld e, TRADE_GIVEMON
ld e, NPCTRADE_GIVEMON
call GetTradeAttribute
ld a, [hl]
ld [wPlayerTrademonSpecies], a
ld e, TRADE_GETMON
ld e, NPCTRADE_GETMON
call GetTradeAttribute
ld a, [hl]
ld [wOTTrademonSpecies], a
@ -167,10 +167,10 @@ DoNPCTrade: ; fcc63
ld a, c
ld [wPlayerTrademonCaughtData], a
ld e, TRADE_DIALOG
ld e, NPCTRADE_DIALOG
call GetTradeAttribute
ld a, [hl]
cp TRADE_DIALOG_GIRL
cp TRADE_DIALOGSET_GIRL
ld a, CAUGHT_BY_GIRL
jr c, .okay
ld a, CAUGHT_BY_BOY
@ -190,17 +190,17 @@ DoNPCTrade: ; fcc63
callfar RemoveMonFromPartyOrBox
predef TryAddMonToParty
ld e, TRADE_DIALOG
ld e, NPCTRADE_DIALOG
call GetTradeAttribute
ld a, [hl]
cp TRADE_COMPLETE
cp TRADE_DIALOG_COMPLETE
ld b, RESET_FLAG
jr c, .incomplete
ld b, SET_FLAG
.incomplete
farcall SetGiftPartyMonCaughtData
ld e, TRADE_NICK
ld e, NPCTRADE_NICK
call GetTradeAttribute
ld de, wOTTrademonNickname
call CopyTradeName
@ -211,7 +211,7 @@ DoNPCTrade: ; fcc63
ld hl, wOTTrademonNickname
call CopyTradeName
ld e, TRADE_OT_NAME
ld e, NPCTRADE_OT_NAME
call GetTradeAttribute
push hl
ld de, wOTTrademonOTName
@ -226,7 +226,7 @@ DoNPCTrade: ; fcc63
ld hl, wOTTrademonOTName
call CopyTradeName
ld e, TRADE_DVS
ld e, NPCTRADE_DVS
call GetTradeAttribute
ld de, wOTTrademonDVs
call Trade_CopyTwoBytes
@ -237,7 +237,7 @@ DoNPCTrade: ; fcc63
ld hl, wOTTrademonDVs
call Trade_CopyTwoBytes
ld e, TRADE_OT_ID
ld e, NPCTRADE_OT_ID
call GetTradeAttribute
ld de, wOTTrademonID + 1
call Trade_CopyTwoBytesReverseEndian
@ -248,7 +248,7 @@ DoNPCTrade: ; fcc63
ld hl, wOTTrademonID
call Trade_CopyTwoBytes
ld e, TRADE_ITEM
ld e, NPCTRADE_ITEM
call GetTradeAttribute
push hl
ld hl, PartyMon1Item
@ -359,7 +359,7 @@ Trade_CopyTwoBytesReverseEndian: ; fce15
; fce1b
GetTradeMonNames: ; fce1b
ld e, TRADE_GETMON
ld e, NPCTRADE_GETMON
call GetTradeAttribute
ld a, [hl]
call GetTradeMonName
@ -367,7 +367,7 @@ GetTradeMonNames: ; fce1b
ld de, StringBuffer2
call CopyTradeName
ld e, TRADE_GIVEMON
ld e, NPCTRADE_GIVEMON
call GetTradeAttribute
ld a, [hl]
call GetTradeMonName
@ -383,16 +383,16 @@ GetTradeMonNames: ; fce1b
dec hl
push hl
ld e, TRADE_GENDER
ld e, NPCTRADE_GENDER
call GetTradeAttribute
ld a, [hl]
pop hl
and a
and a ; TRADE_GENDER_EITHER
ret z
cp TRADE_MALE_ONLY
cp TRADE_GENDER_MALE
ld a, "♂"
jr z, .done
; TRADE_GENDER_FEMALE
ld a, "♀"
.done
ld [hli], a
@ -423,28 +423,28 @@ PrintTradeText: ; fcf38
; fcf53
TradeTexts: ; fcf53
; entries correspond to TRADE_* × TRADE_DIALOG_* constants
; TRADE_INTRO
; entries correspond to TRADE_DIALOG_* × TRADE_DIALOGSET_* constants
; TRADE_DIALOG_INTRO
dw TradeIntroText1
dw TradeIntroText2
dw TradeIntroText3
dw TradeIntroText4
; TRADE_CANCEL
; TRADE_DIALOG_CANCEL
dw TradeCancelText1
dw TradeCancelText2
dw TradeCancelText3
dw TradeCancelText4
; TRADE_WRONG
; TRADE_DIALOG_WRONG
dw TradeWrongText1
dw TradeWrongText2
dw TradeWrongText3
dw TradeWrongText4
; TRADE_COMPLETE
; TRADE_DIALOG_COMPLETE
dw TradeCompleteText1
dw TradeCompleteText2
dw TradeCompleteText3
dw TradeCompleteText4
; TRADE_AFTER
; TRADE_DIALOG_AFTER
dw TradeAfterText1
dw TradeAfterText2
dw TradeAfterText3

View File

@ -462,7 +462,7 @@ INCLUDE "engine/battle/misc.asm"
SECTION "bank3F", ROMX
INCLUDE "engine/tileset_anims.asm"
INCLUDE "engine/npctrade.asm"
INCLUDE "engine/events/npc_trade.asm"
INCLUDE "engine/events/mom_phone.asm"

View File

@ -9,7 +9,7 @@ BlackthornEmysHouse_MapScripts:
Emy:
faceplayer
opentext
trade NPCTRADE_EMY
trade NPC_TRADE_EMY
waitbutton
closetext
end

View File

@ -281,18 +281,18 @@ BurnedTower1F_MapEvents:
db 14 ; warp events
warp_event 9, 15, 13, ECRUTEAK_CITY
warp_event 10, 15, 13, ECRUTEAK_CITY
warp_event 10, 9, 1, BURNED_TOWER_B1F
warp_event 5, 5, 1, BURNED_TOWER_B1F
warp_event 5, 6, 1, BURNED_TOWER_B1F
warp_event 4, 6, 1, BURNED_TOWER_B1F
warp_event 15, 4, 2, BURNED_TOWER_B1F
warp_event 15, 5, 2, BURNED_TOWER_B1F
warp_event 10, 7, 3, BURNED_TOWER_B1F
warp_event 5, 14, 4, BURNED_TOWER_B1F
warp_event 4, 14, 4, BURNED_TOWER_B1F
warp_event 14, 14, 5, BURNED_TOWER_B1F
warp_event 15, 14, 5, BURNED_TOWER_B1F
warp_event 7, 15, 6, BURNED_TOWER_B1F
warp_event 10, 9, 1, BURNED_TOWER_B1F
warp_event 5, 5, 1, BURNED_TOWER_B1F
warp_event 5, 6, 1, BURNED_TOWER_B1F
warp_event 4, 6, 1, BURNED_TOWER_B1F
warp_event 15, 4, 2, BURNED_TOWER_B1F
warp_event 15, 5, 2, BURNED_TOWER_B1F
warp_event 10, 7, 3, BURNED_TOWER_B1F
warp_event 5, 14, 4, BURNED_TOWER_B1F
warp_event 4, 14, 4, BURNED_TOWER_B1F
warp_event 14, 14, 5, BURNED_TOWER_B1F
warp_event 15, 14, 5, BURNED_TOWER_B1F
warp_event 7, 15, 6, BURNED_TOWER_B1F
db 1 ; coord events
coord_event 11, 9, 1, BurnedTowerRivalBattleScript

View File

@ -124,7 +124,7 @@ GoldenrodDeptStore5FLassScript:
Mike:
faceplayer
opentext
trade NPCTRADE_MIKE
trade NPC_TRADE_MIKE
waitbutton
closetext
end

View File

@ -9,7 +9,7 @@ OlivineTimsHouse_MapScripts:
Tim:
faceplayer
opentext
trade NPCTRADE_TIM
trade NPC_TRADE_TIM
waitbutton
closetext
end

View File

@ -30,7 +30,7 @@ PewterPokecenter1FBugCatcherScript:
Chris:
faceplayer
opentext
trade NPCTRADE_CHRIS
trade NPC_TRADE_CHRIS
waitbutton
closetext
end

View File

@ -189,7 +189,7 @@ UnknownScript_0x188ec5:
Forest:
faceplayer
opentext
trade NPCTRADE_FOREST
trade NPC_TRADE_FOREST
waitbutton
closetext
end

View File

@ -12,7 +12,7 @@ Route14_MapScripts:
Kim:
faceplayer
opentext
trade NPCTRADE_KIM
trade NPC_TRADE_KIM
waitbutton
closetext
end

View File

@ -13,7 +13,7 @@ VioletKylesHousePokefanMScript:
Kyle:
faceplayer
opentext
trade NPCTRADE_KYLE
trade NPC_TRADE_KYLE
waitbutton
closetext
end