Skip to content

Commit

Permalink
Merge pull request #1887 from avionanx/main
Browse files Browse the repository at this point in the history
Change unlock party fixes so it sets vram slots (closes #1870)
  • Loading branch information
LordMonoxide authored Dec 24, 2024
2 parents dde3506 + a39e86c commit 5823780
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 17 deletions.
2 changes: 1 addition & 1 deletion patches/scripts.csv
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ diff,SECT/DRGN0.BIN/5528/1,scripts/DRGN0/5528/1.diff,"Lloyd Flanvel Cutscene, fo
diff,SECT/DRGN0.BIN/5532/1,scripts/DRGN0/5532/1.diff,"Divine Dragon Death Cutscene, force-load Dart"
diff,SECT/DRGN0.BIN/5538/1,scripts/DRGN0/5538/1.diff,"Lenus Death Cutscene, force-load Dart"
diff,SECT/DRGN0.BIN/5548/1,scripts/DRGN0/5548/1.diff,"Mappi I Cutscene, force-load Dart"
diff,SECT/DRGN0.BIN/5550/1,scripts/DRGN0/5550/1.diff,"Mappi I Cutscene, force-load Dart, Haschel"
diff,SECT/DRGN0.BIN/5550/1,scripts/DRGN0/5550/1.diff,"Gehrich Cutscene, force-load Dart, Haschel"
diff,SECT/DRGN0.BIN/5560/1,scripts/DRGN0/5560/1.diff,"Virage I Cutscene, force-load Dart, Lavitz, Shana, Rose"
diff,SECT/DRGN0.BIN/5562/1,scripts/DRGN0/5562/1.diff,"Virage II Cutscene, force-load Dart"
diff,SECT/DRGN0.BIN/5572/1,scripts/DRGN0/5572/1.diff,"Urobolus Cutscene, force-load Dart, Lavitz, Shana"
Expand Down
10 changes: 5 additions & 5 deletions patches/scripts/DRGN0/5518/1.diff
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,22 @@
data 0x14
data 0x1
+LOAD_SLOTTED_TEXTURES:
+jmp_cmp >=, inl[:CHAR_INDEX], 0x3, inl[:LOAD_ENEMY_TEXTURE]
+jmp_cmp ==, stor[13], 0xc, inl[:LOAD_PLAYER_TEXTURE]
+jmp_cmp ==, stor[13], 0xd, inl[:LOAD_PLAYER_TEXTURE]
+LOAD_ENEMY_TEXTURE:
+call 364, stor[8], stor[9]
+return
+LOAD_PLAYER_TEXTURE:
+incr inl[:CHAR_INDEX]
+call 1020, stor[8], inl[:CHAR_INDEX]
+call 364, stor[8], stor[9]
+call 1020, stor[8], 0xffffffff
+incr inl[:CHAR_INDEX]
+return
+CHAR_INDEX:
+data 0x0
+KILL_LAVITZ:
+mov inl[:P_INDEX], stor[22]
+call 167, var[34][stor[22]], stor[10]
+mov inl[:P_INDEX], stor[10]
+call 167, var[34][stor[10]], stor[10]
+jmp_cmp ==, stor[10], 0x1, inl[:SET_DEAD]
+incr inl[:P_INDEX]
+jmp_cmp ==, var[35], inl[:P_INDEX], inl[:NOT_FOUND]
Expand All @@ -144,5 +144,5 @@
+NOT_FOUND:
+return
+SET_DEAD:
+call 173, var[34][stor[22]], 0x1
+call 173, stor[10], 0x1
+return
26 changes: 26 additions & 0 deletions patches/scripts/DRGN0/5532/1.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
--- original
+++ modified
@@ -515,7 +515,7 @@
incr stor[18]
call 354, 0x0, stor[18], stor[9]
call 355, stor[9]
-call 364, stor[8], stor[9]
+gosub inl[:LOAD_SLOTTED_TEXTURES]
call 356, stor[9]
call 354, 0x0, stor[16], stor[9]
call 355, stor[9]
@@ -854,6 +854,10 @@
data 0x8e
data 0x8a
Expand Down Expand Up @@ -40,3 +49,20 @@
mov 0x3, stor[stor[stor[0], 23], 24]
call 618, stor[23], inl[:LABEL_5]
return
@@ -1750,3 +1754,16 @@
return
ENTRYPOINT_1:
rewind
+LOAD_SLOTTED_TEXTURES:
+jmp_cmp >=, inl[:CHAR_INDEX], 0x3, inl[:LOAD_ENEMY_TEXTURE]
+jmp_cmp ==, stor[13], 0xc, inl[:LOAD_PLAYER_TEXTURE]
+LOAD_ENEMY_TEXTURE:
+call 364, stor[8], stor[9]
+return
+LOAD_PLAYER_TEXTURE:
+incr inl[:CHAR_INDEX]
+call 1020, stor[8], inl[:CHAR_INDEX]
+call 364, stor[8], stor[9]
+return
+CHAR_INDEX:
+data 0x0
4 changes: 2 additions & 2 deletions patches/scripts/DRGN0/5550/1.diff
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@
LABEL_131:
data 0x1
+LOAD_SLOTTED_TEXTURES:
+jmp_cmp >=, inl[:CHAR_INDEX], 0x3, inl[:LOAD_ENEMY_TEXTURE]
+jmp_cmp ==, stor[13], 0xc, inl[:LOAD_PLAYER_TEXTURE]
+jmp_cmp ==, stor[13], 0xd, inl[:LOAD_PLAYER_TEXTURE]
+LOAD_ENEMY_TEXTURE:
+call 364, stor[8], stor[9]
+return
+LOAD_PLAYER_TEXTURE:
+incr inl[:CHAR_INDEX]
+call 1020, stor[8], inl[:CHAR_INDEX]
+call 364, stor[8], stor[9]
+call 1020, stor[8], 0xffffffff
+incr inl[:CHAR_INDEX]
+return
+CHAR_INDEX:
+data 0x0
29 changes: 29 additions & 0 deletions patches/scripts/DRGN0/5560/1.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
--- original
+++ modified
@@ -1233,7 +1233,7 @@
incr stor[18]
call 354, 0x0, stor[18], stor[9]
call 355, stor[9]
-call 364, stor[8], stor[9]
+gosub inl[:LOAD_SLOTTED_TEXTURES]
call 356, stor[9]
call 354, 0x0, stor[16], stor[9]
call 355, stor[9]
@@ -1629,6 +1629,22 @@
data 0x5
data 0x0
Expand Down Expand Up @@ -46,3 +55,23 @@
mov var[34][0], stor[27]
call 370, stor[27], stor[8]
mov stor[8], var[45][2]
@@ -3276,3 +3301,19 @@
data 0xa
LABEL_90:
data 0x1
+LOAD_SLOTTED_TEXTURES:
+jmp_cmp >=, inl[:CHAR_INDEX], 0x3, inl[:LOAD_ENEMY_TEXTURE]
+jmp_cmp ==, stor[13], 0xc, inl[:LOAD_PLAYER_TEXTURE]
+jmp_cmp ==, stor[13], 0xf, inl[:LOAD_PLAYER_TEXTURE]
+jmp_cmp ==, stor[13], 0xd, inl[:LOAD_PLAYER_TEXTURE]
+jmp_cmp ==, stor[13], 0xe, inl[:LOAD_PLAYER_TEXTURE]
+LOAD_ENEMY_TEXTURE:
+call 364, stor[8], stor[9]
+return
+LOAD_PLAYER_TEXTURE:
+incr inl[:CHAR_INDEX]
+call 1020, stor[8], inl[:CHAR_INDEX]
+call 364, stor[8], stor[9]
+return
+CHAR_INDEX:
+data 0x0
26 changes: 26 additions & 0 deletions patches/scripts/DRGN0/5562/1.diff
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,29 @@
call 618, stor[23], inl[:LABEL_15]
return
LABEL_2:
@@ -956,7 +956,7 @@
incr stor[18]
call 354, 0x0, stor[18], stor[9]
call 355, stor[9]
-call 364, stor[8], stor[9]
+gosub inl[:LOAD_SLOTTED_TEXTURES]
call 356, stor[9]
call 354, 0x0, stor[16], stor[9]
call 355, stor[9]
@@ -3040,3 +3040,16 @@
data 0xe
LABEL_101:
data 0x1
+LOAD_SLOTTED_TEXTURES:
+jmp_cmp >=, inl[:CHAR_INDEX], 0x3, inl[:LOAD_ENEMY_TEXTURE]
+jmp_cmp ==, stor[13], 0xc, inl[:LOAD_PLAYER_TEXTURE]
+LOAD_ENEMY_TEXTURE:
+call 364, stor[8], stor[9]
+return
+LOAD_PLAYER_TEXTURE:
+incr inl[:CHAR_INDEX]
+call 1020, stor[8], inl[:CHAR_INDEX]
+call 364, stor[8], stor[9]
+return
+CHAR_INDEX:
+data 0x0
4 changes: 2 additions & 2 deletions patches/scripts/DRGN0/5606/1.diff
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@
data 0xa
data 0x1
+LOAD_SLOTTED_TEXTURES:
+jmp_cmp >=, inl[:CHAR_INDEX], 0x3, inl[:LOAD_ENEMY_TEXTURE]
+jmp_cmp ==, stor[13], 0xb, inl[:LOAD_PLAYER_TEXTURE]
+LOAD_ENEMY_TEXTURE:
+call 364, stor[8], stor[9]
+return
+LOAD_PLAYER_TEXTURE:
+incr inl[:CHAR_INDEX]
+call 1020, stor[8], inl[:CHAR_INDEX]
+call 364, stor[8], stor[9]
+call 1020, stor[8], 0xffffffff
+incr inl[:CHAR_INDEX]
+return
+CHAR_INDEX:
+data 0x0
4 changes: 2 additions & 2 deletions patches/scripts/DRGN0/5610/1.diff
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@
LABEL_69:
data 0x1
+LOAD_SLOTTED_TEXTURES:
+jmp_cmp >=, inl[:CHAR_INDEX], 0x3, inl[:LOAD_ENEMY_TEXTURE]
+jmp_cmp ==, stor[13], 0xc, inl[:LOAD_PLAYER_TEXTURE]
+LOAD_ENEMY_TEXTURE:
+call 364, stor[8], stor[9]
+return
+LOAD_PLAYER_TEXTURE:
+incr inl[:CHAR_INDEX]
+call 1020, stor[8], inl[:CHAR_INDEX]
+call 364, stor[8], stor[9]
+call 1020, stor[8], 0xffffffff
+incr inl[:CHAR_INDEX]
+return
+CHAR_INDEX:
+data 0x0
11 changes: 6 additions & 5 deletions src/main/java/legend/game/combat/Battle.java
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ public Function<RunningScript, FlowControl>[] getScriptFunctions() {
functions[1010] = this::scriptUseItem;
functions[1011] = this::scriptApplyEquipmentEffect;

functions[1020] = this::scriptSetCombatantCharSlot;
functions[1020] = this::scriptSetCombatantVramSlot;
return functions;
}

Expand Down Expand Up @@ -1110,11 +1110,12 @@ private FlowControl scriptApplyEquipmentEffect(final RunningScript<BattleEntity2
return FlowControl.CONTINUE;
}

@ScriptDescription("Changes char slot of a combatant")
@ScriptDescription("Changes vram slot of a combatant")
@ScriptParam(direction = ScriptParam.Direction.IN, type = ScriptParam.Type.INT, name = "combatantIndex", description = "Combatant ID")
@ScriptParam(direction = ScriptParam.Direction.IN, type = ScriptParam.Type.INT, name = "charSlot", description = "Target character slot")
private FlowControl scriptSetCombatantCharSlot(final RunningScript<BattleEntity27c> script) {
this.combatants_8005e398[script.params_20[0].get()].charSlot_19c = script.params_20[1].get();
@ScriptParam(direction = ScriptParam.Direction.IN, type = ScriptParam.Type.INT, name = "vramSlot", description = "Target vram slot")
private FlowControl scriptSetCombatantVramSlot(final RunningScript<BattleEntity27c> script) {
this.unsetMonsterTextureSlotUsed(this.combatants_8005e398[script.params_20[0].get()].vramSlot_1a0);
this.combatants_8005e398[script.params_20[0].get()].vramSlot_1a0 = script.params_20[1].get();
return FlowControl.CONTINUE;
}

Expand Down

0 comments on commit 5823780

Please sign in to comment.