Skip to content

Commit

Permalink
Fix issue with debuffs not applying if you had the buff yourself (Fir…
Browse files Browse the repository at this point in the history
…eEmblemUniverse#524)

* UTF8 Support

* Fix push & offset numbers drawn

* Fix issue with debuffs not applying if you had the buff yourself

* Revert "Fix push & offset numbers drawn"

This reverts commit 3899197.

* Revert "UTF8 Support"

This reverts commit 46599e8.

---------

Co-authored-by: Veslyquix <[email protected]>
  • Loading branch information
2 people authored and Huichelaar committed Sep 22, 2023
1 parent 5475da0 commit 3e53c04
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ ALIGN 4
PUSH
ORG CURRENTOFFSET+$1;DebuffGivenTableEntry:
POP
WORD $1C06B5F0 $188900D2 $4A1A1C0F $1C0C6811 $25002240 $35013D01 $DA2842A5 $4A161C30 $1C296812
WORD $1C06B5F0 $188900D2 $4A231C0F $1C0C6811 $25002240 $35013D01 $DA3A42A5 $29005D61 $1C30D0F9 $401122C0 $D0022900 $D00029C0 $4A1A1C38 $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
WORD $29005D79 $2980D0E7 $1C0BDA09 $28004393 $4143DA00 $DBDE4283 $D00A4211 $233FE011 $425B400B $DD002800 $42834143 $4211DCD3 $1C30D007 $68124A09 $43511C29
SHORT ((PackData_Signed-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((PackData_Signed-4-CURRENTOFFSET>>1)&$7FF)|$F800
WORD $BCF0E7D3 $4700BC01
WORD $1C30E7C9 $68124A05 $43511C29
SHORT ((PackData_Signed-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((PackData_Signed-4-CURRENTOFFSET>>1)&$7FF)|$F800
WORD $BCF0E7C1 $4700BC01
POIN DebuffNumberOfStats_Link
POIN DebuffStatNumberOfBits_Link
33 changes: 31 additions & 2 deletions EngineHacks/Necessary/Debuffs/asm/DebuffGivenTableEntry.s
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,19 @@ add r5, #1
cmp r5, r4
bge End

ldrb r1, [r4, r5] @ what should the next byte do
cmp r1, #0
beq Loop
mov r0, r6 @ debuff entry
mov r2, #0xC0
and r1, r2
cmp r1, #0
beq User
cmp r1, #0xC0
beq User
mov r0, r7 @ enemy
User:

ldr r2, =DebuffStatNumberOfBits_Link
ldr r2, [r2]
mov r1, r5 @ counter
Expand Down Expand Up @@ -69,7 +81,7 @@ cmp r3, r0
blt Loop @ if buffed stat is worse than what we already had, do nothing
tst r1, r2
beq AffectUser
b End
b AffectEnemy

NegativeA: @ new value will be negative
mov r3, #0x3F
Expand All @@ -82,7 +94,7 @@ 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
beq AffectEnemy

AffectUser:
mov r0, r6 @ debuff entry
Expand All @@ -93,6 +105,23 @@ mul r1, r2 @ bit offset
bl PackData_Signed
b Loop


AffectEnemy:
mov r0, r6 @ debuff entry
ldr r2, =DebuffStatNumberOfBits_Link
ldr r2, [r2]
mov r1, r5 @ counter
mul r1, r2 @ bit offset
bl PackData_Signed
@mov r0, r6 @ debuff entry
@ldr r2, =DebuffStatNumberOfBits_Link
@ldr r2, [r2]
@mov r1, r5 @ counter
@mul r1, r2 @ bit offset
@bl UnpackData_Signed @ ????????????
@mov r11, r11 @ this was done for testing that inputted value = outputted value
b Loop

End:

pop {r4-r7}
Expand Down
14 changes: 7 additions & 7 deletions EngineHacks/Necessary/Debuffs/asm/SetDebuffs.lyn.event
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ SHORT $1C06
SHORT $1C28
SHORT ((GetUnitDebuffEntry-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((GetUnitDebuffEntry-4-CURRENTOFFSET>>1)&$7FF)|$F800
SHORT $1C07
WORD $5A202048 $F8A2F000 $D0282800 $42082180 $1C30D005 $68094919
WORD $5A202048 $F8ACF000 $D0282800 $42082180 $1C30D005 $68094919
SHORT ((SetBit-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((SetBit-4-CURRENTOFFSET>>1)&$7FF)|$F800
WORD $1C30E004 $68094916
SHORT ((UnsetBit-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((UnsetBit-4-CURRENTOFFSET>>1)&$7FF)|$F800
WORD $5A202048 $F88EF000 $42082140 $1C30D005 $68094911
WORD $5A202048 $F898F000 $42082140 $1C30D005 $68094911
SHORT ((SetBit-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((SetBit-4-CURRENTOFFSET>>1)&$7FF)|$F800
WORD $1C30E004 $6809490E
SHORT ((UnsetBit-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((UnsetBit-4-CURRENTOFFSET>>1)&$7FF)|$F800
WORD $5A202048 $F87CF000 $1C321C21 $F0001C3B $2048F813 $F0005A28 $211FF873 $1C294008 $1C331C3A $F808F000 $BC01BCF0 $4700
WORD $5A202048 $F886F000 $1C321C21 $F0001C3B $2048F813 $F0005A28 $211FF87D $1C294008 $1C331C3A $F808F000 $BC01BCF0 $4700
POIN HalfStrBitOffset_Link
POIN HalfMagBitOffset_Link
WORD $241FB5F0 $207C4004 $46455C28 $1C0DB420 $1C1F1C16 $40082101 $68094927 $D1012901 $D0432800 $68114A25 $22404688 $E44B24 $250018E4 $35013D01 $DA374545 $4A211C30 $1C296812
WORD $241FB5F0 $207C4004 $46455C28 $1C0DB420 $1C1F1C16 $40082101 $6809492C $D1012901 $D04D2800 $68114A2A $22404688 $E44B29 $250018E4 $35013D01 $DA414545 $29005D61 $1C30D0F9 $401122C0 $D0022900 $D00029C0 $4A211C38 $1C296812
SHORT $4351
SHORT ((UnpackData_Signed-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((UnpackData_Signed-4-CURRENTOFFSET>>1)&$7FF)|$F800
SHORT $2240
WORD $29005D61 $2980D0F1 $1C0BDA09 $28004393 $4143DA00 $DBE84283 $D00A4211 $233FE011 $425B400B $DD002800 $42834143 $4211DCDD $1C30D007 $68124A10 $43511C29
WORD $29005D61 $2980D0E7 $1C0BDA09 $28004393 $4143DA00 $DBDE4283 $D00A4211 $233FE011 $425B400B $DD002800 $42834143 $4211DCD3 $1C30D007 $68124A10 $43511C29
SHORT ((PackData_Signed-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((PackData_Signed-4-CURRENTOFFSET>>1)&$7FF)|$F800
WORD $1C38E7D3 $68124A0C $43511C29
WORD $1C38E7C9 $68124A0C $43511C29
SHORT ((PackData_Signed-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((PackData_Signed-4-CURRENTOFFSET>>1)&$7FF)|$F800
WORD $4A091C38 $1C296812
SHORT $4351
SHORT ((UnpackData_Signed-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((UnpackData_Signed-4-CURRENTOFFSET>>1)&$7FF)|$F800
SHORT $E7C4
SHORT $E7BA
WORD $46A8BC20 $BC01BCF0 $4700
POIN RequireDamageToDebuff_Link
POIN DebuffNumberOfStats_Link
Expand Down
13 changes: 12 additions & 1 deletion EngineHacks/Necessary/Debuffs/asm/SetDebuffs.s
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,19 @@ add r5, #1
cmp r5, r8
bge BreakLoop

ldrb r1, [r4, r5] @ what should the next byte do
cmp r1, #0
beq Loop
mov r0, r6 @ debuff entry
mov r2, #0xC0
and r1, r2
cmp r1, #0
beq User
cmp r1, #0xC0
beq User
mov r0, r7 @ enemy
User:

ldr r2, =DebuffStatNumberOfBits_Link
ldr r2, [r2]
mov r1, r5 @ counter
Expand Down Expand Up @@ -291,4 +303,3 @@ EALiterals:

@ ItemTableLocation:
@ .long 0x08809B10

0 comments on commit 3e53c04

Please sign in to comment.