Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support skill learning on promotion #67

Merged
merged 16 commits into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Auto detect text files and perform LF normalization
* text=auto

*.event text
*.txt text
*.s text
*.asm text
*.nmm text
*.csv text
*.bat text
*.log text

# Custom for Visual Studio
*.cs diff=csharp

Expand Down
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,23 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

#rom stuff
# rom stuff
*.gba
*.sav
*.sgm

# textprocess_v2 text entries
_textentries

# text-process-classic text entries
.TextEntries

# python cache
__pycache__

# c2ea cache
.cache

# =========================
# Operating System Files
# =========================
Expand Down
25 changes: 25 additions & 0 deletions Engine Hacks/DisplayWRankOnLevelUp/DisplayWRankOnLevelUp.event
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef WRANK_ON_LEVELUP
#define WRANK_ON_LEVELUP

// Display new weapon rank on wrank up
// Original hack by Tequila
// Rewrite for PopR by Stan

// See Engine Hacks/Popups.event for usage

#include "asm/DWROLU.lyn.event"

ALIGN 4
WeaponRankUpPopup:
// Popup macros are defined in [PopupRework/]Extensions/PopupDefinitions.txt

Popup_SetSound(0x5A)

Popup_StringId(1) // a space
Popup_WTypeIcon // wtype icon
Popup_StringId(textWeaponRankIncreasedTo) // using definition to force error when missing
WORD 0x0E 0 // the new stuff!

Popup_End

#endif // WRANK_ON_LEVELUP
18 changes: 18 additions & 0 deletions Engine Hacks/DisplayWRankOnLevelUp/asm/DWROLU.lyn.event
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ALIGN 4
PUSH
ORG CURRENTOFFSET+$9d;InitWeaponLevelUpPopup:
POP
SHORT $A001 $3001 $E038 $46C0 $B501 $4B07 $4807 $6800 $F000 $F809 $4669 $2200 $7008 $704A $4B04 $4668 $F000 $F801 $BC0C $4718
BYTE $F9 $6D $1 $8 $F8 $5 $0 $3 $DD $3E $0 $8
SHORT $B510 $1C0C $A003 $3001 $F000 $F81C $BC10 $BC02 $4708 $46C0 $B501 $4B08 $4808 $6800 $F7FF $FFE9 $4669 $2200 $7008 $704A $4B05 $1C20 $4669 $F7FF $FFE0 $BC0C $4718
BYTE $0 $0 $F9 $6D $1 $8 $F8 $5 $0 $3 $5 $40 $0 $8
SHORT $B500 $4906 $6809 $684A $B406 $4A05 $604A $F000 $F804 $BC06 $604A $BC08 $4718 $4700
BYTE $70 $8E $2 $2 $44 $B $59 $8
SHORT $B510 $4C0E $4B0E $1C20 $F7FF $FFBF $2800 $D109 $4C0C $4B0B $1C20 $F7FF $FFB8 $2800 $D102 $BC10 $BC02 $4708 $4B08 $1C20 $F7FF $FFAF $4907 $6008 $2050 $5C20 $4906 $8008 $2001 $E7F0
BYTE $EC $A4 $3 $2 $D9 $A7 $7 $8 $6C $A5 $3 $2 $B5 $C0 $2 $8 $F8 $5 $0 $3 $F4 $5 $0 $3
ALIGN 4
PUSH
ORG CURRENTOFFSET+$0;PopRWeaponLevelComponent:
POP
POIN CURRENTOFFSET-239
POIN CURRENTOFFSET-191
215 changes: 215 additions & 0 deletions Engine Hacks/DisplayWRankOnLevelUp/asm/DWROLU.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@

.thumb

@ build using lyn

Text_GetStringTextWidth = 0x08003EDC|1
Text_DrawString = 0x08004004|1

GetWRankSpecialChar = 0x08016DF8|1
GetBattleUnitUpdatedWeaponExp = 0x0802C0B4|1
BattleUnit_ShouldDisplayWRankUp = 0x0807A7D8|1

gpCurrentFont = 0x02028E70

gPopupItem = 0x030005F4
gPopupNumber = 0x030005F8

gBattleActor = 0x0203A4EC
gBattleTarget = 0x0203A56C

.type PopRWeaponLevelComponent, object
.global PopRWeaponLevelComponent

.type InitWeaponLevelUpPopup, function
.global InitWeaponLevelUpPopup

.type PopRWRankTextLength, function
.type PopRWRankTextDisplay, function
.type DoWithSpecialCharGlyphSet, function

PopRWRankTextLength:
adr r0, PopRWRankTextLength.do
add r0, #1

@ we do not need to go back here
@ so we let DoWithSpecialCharGlyphSet return to this function's caller immediately
@ and just b there instead of bl

b DoWithSpecialCharGlyphSet

.align

PopRWRankTextLength.do:
push {r0, lr} @ pushing r0 to make 4 bytes of space on the stack

ldr r3, =GetWRankSpecialChar

ldr r0, =gPopupNumber
ldr r0, [r0] @ arg r0 = wrank

bl BXR3

@ make string ("<char>\x00")

mov r1, sp
mov r2, #0

strb r0, [r1]
strb r2, [r1, #1]

ldr r3, =Text_GetStringTextWidth

mov r0, sp @ arg r0 = string

bl BXR3

pop {r2, r3}
BXR3:
bx r3

.pool
.align

PopRWRankTextDisplay:
push {r4, lr}

mov r4, r1 @ var r4 = text

adr r0, PopRWRankTextDisplay.do
add r0, #1

bl DoWithSpecialCharGlyphSet

pop {r4}

pop {r1}
bx r1

.align

PopRWRankTextDisplay.do:
push {r0, lr} @ pushing r0 to make 4 bytes of space on the stack

ldr r3, =GetWRankSpecialChar

ldr r0, =gPopupNumber
ldr r0, [r0] @ arg r0 = wrank

bl BXR3

@ make string ("<char>\x00")

mov r1, sp
mov r2, #0

strb r0, [r1]
strb r2, [r1, #1]

ldr r3, =Text_DrawString

mov r0, r4 @ arg r0 = text
mov r1, sp @ arg r1 = string

bl BXR3

pop {r2, r3}
bx r3

.pool
.align

DoWithSpecialCharGlyphSet:
@ argument: r0 = function pointer
@ note: registers r4-r11 are unchanged, making them suitable to pass information from caller to wrapper function

push {lr}

ldr r1, =gpCurrentFont
ldr r1, [r1] @ r1 = current font

ldr r2, [r1, #4]

push {r1-r2}

ldr r2, =0x08590B44 @ special char glyph set
str r2, [r1, #4]

bl BXR0

pop {r1-r2}

str r2, [r1, #4] @ restore previous glyph set

pop {r3}
bx r3

BXR0:
bx r0

.pool
.align

InitWeaponLevelUpPopup:
push {r4, lr}

@ check acting unit

ldr r4, =gBattleActor

ldr r3, =BattleUnit_ShouldDisplayWRankUp
mov r0, r4 @ arg r0 = bu
bl BXR3

cmp r0, #0
bne InitWeaponLevelUpPopup.yes

@ check target unit

ldr r4, =gBattleTarget

ldr r3, =BattleUnit_ShouldDisplayWRankUp
mov r0, r4 @ arg r0 = bu
bl BXR3

cmp r0, #0
bne InitWeaponLevelUpPopup.yes

InitWeaponLevelUpPopup.no:
@ implied @ return 0

InitWeaponLevelUpPopup.end:
pop {r4}

pop {r1}
bx r1

InitWeaponLevelUpPopup.yes:
ldr r3, =GetBattleUnitUpdatedWeaponExp

mov r0, r4 @ arg r0 = bu

bl BXR3

ldr r1, =gPopupNumber
str r0, [r1] @ store new wexp as popup number

mov r0, #0x50
ldrb r0, [r4, r0] @ load wtype

ldr r1, =gPopupItem
strh r0, [r1] @ store wtype as popup item (as vanilla does it)

mov r0, #1

b InitWeaponLevelUpPopup.end

.pool
.align

.section .rodata

PopRWeaponLevelComponent:
.word PopRWRankTextLength
.word PopRWRankTextDisplay

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

ALIGN 4
New_Numbers:
#incext Png2Dmp "New_Numbers.png" --lz77
#incext Png2Dmp "new_numbers.png" --lz77

// #else
// ERROR "You're not assembling FE8 events!"
Expand Down
Loading