-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Veslyquix <[email protected]>
- Loading branch information
Showing
7 changed files
with
145 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
EngineHacks/Necessary/Debuffs/asm/DebuffGivenTableEntry.lyn.event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ALIGN 4 | ||
PUSH | ||
ORG CURRENTOFFSET+$1;DebuffGivenTableEntry: | ||
POP | ||
WORD $1C06B5F0 $188900D2 $4A1A1C0F $1C0C6811 $25002240 $35013D01 $DA2842A5 $4A161C30 $1C296812 | ||
SHORT $4351 | ||
SHORT ((UnpackData_Signed-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((UnpackData_Signed-4-CURRENTOFFSET>>1)&$7FF)|$F800 | ||
SHORT $2240 | ||
WORD $29005D79 $2980D0F1 $1C0BDA09 $28004393 $4143DA00 $DBE84283 $D00A4211 $233FE011 $425B400B $DD002800 $42834143 $4211DCDD $1C30D007 $68124A05 $43511C29 | ||
SHORT ((PackData_Signed-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((PackData_Signed-4-CURRENTOFFSET>>1)&$7FF)|$F800 | ||
WORD $BCF0E7D3 $4700BC01 | ||
POIN DebuffNumberOfStats_Link | ||
POIN DebuffStatNumberOfBits_Link |
102 changes: 102 additions & 0 deletions
102
EngineHacks/Necessary/Debuffs/asm/DebuffGivenTableEntry.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
.thumb | ||
|
||
.global DebuffGivenTableEntry | ||
.type DebuffGivenTableEntry, %function | ||
DebuffGivenTableEntry: | ||
push {r4-r7, lr} | ||
mov r6, r0 @ debuff entry | ||
@r1 debuff table to use | ||
@r2 entry ID of the given table | ||
|
||
lsl r2, #3 @ 8 bytes per entry | ||
add r1, r2 @ table entry we desire | ||
mov r7, r1 @ table entry | ||
|
||
@ r5 = counter of which stat we're on | ||
ldr r2, =DebuffNumberOfStats_Link | ||
ldr r1, [r2] @ max | ||
mov r4, r1 | ||
|
||
mov r2, #0x40 @ no 0x40 bitflag of Swap | ||
|
||
mov r5, #0 @ counter | ||
sub r5, #1 | ||
|
||
Loop: | ||
add r5, #1 | ||
cmp r5, r4 | ||
bge End | ||
|
||
mov r0, r6 @ debuff entry | ||
ldr r2, =DebuffStatNumberOfBits_Link | ||
ldr r2, [r2] | ||
mov r1, r5 @ counter | ||
mul r1, r2 @ bit offset | ||
bl UnpackData_Signed | ||
@ r0 as data | ||
mov r2, #0x40 | ||
ldrb r1, [r7, r5] @ table data uses a byte per stat | ||
|
||
|
||
@ positive affects user | ||
@ positive swap affects opponent | ||
@ negative affects enemy | ||
@ negative swap affects self | ||
|
||
@ if new value is positive | ||
@ > positive old value, replace | ||
@ < positive old value, ignore | ||
@ negative old value, add | ||
|
||
@ if new value is negative | ||
@ > old value, ignore | ||
@ < old value, replace | ||
@ positive old value, add | ||
|
||
cmp r1, #0 | ||
beq Loop | ||
cmp r1, #0x80 | ||
bge NegativeA | ||
|
||
@ new value is positive | ||
mov r3, r1 | ||
bic r3, r2 @ remove 0x40 swap bitflag | ||
cmp r0, #0 | ||
bge DontAddToValue | ||
adc r3, r0 @ to remove negatives first | ||
DontAddToValue: | ||
cmp r3, r0 | ||
blt Loop @ if buffed stat is worse than what we already had, do nothing | ||
tst r1, r2 | ||
beq AffectUser | ||
b End | ||
|
||
NegativeA: @ new value will be negative | ||
mov r3, #0x3F | ||
and r3, r1 | ||
neg r3, r3 | ||
cmp r0, #0 | ||
ble DontAddToValue_Negative | ||
adc r3, r0 @ to remove positives first | ||
DontAddToValue_Negative: | ||
cmp r3, r0 | ||
bgt Loop @ if debuffed stat is less bad than before (a higher # since we're negative), do nothing | ||
tst r1, r2 | ||
beq End | ||
|
||
AffectUser: | ||
mov r0, r6 @ debuff entry | ||
ldr r2, =DebuffStatNumberOfBits_Link | ||
ldr r2, [r2] | ||
mov r1, r5 @ counter | ||
mul r1, r2 @ bit offset | ||
bl PackData_Signed | ||
b Loop | ||
|
||
End: | ||
|
||
pop {r4-r7} | ||
pop {r0} | ||
bx r0 | ||
.ltorg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters