Skip to content

Commit

Permalink
Enable multi-side support for loading side-specific MIX files for DTA
Browse files Browse the repository at this point in the history
  • Loading branch information
Rampastring committed Oct 10, 2024
1 parent 3f40b75 commit a43a285
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions src/dta_hacks.asm
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,29 @@ sstring str_BriefingPCX, "BRIEFING.PCX"
@SET 0x00601093, push str_SettingsINI
@SET 0x00687E07, push str_SettingsINI

; Set global variable byte containing side ID to load files for
; (enabled until spawner has been reimplemented through Vinifera)
@SET 0x004E2CFA, {mov byte [0x7E2500], al}
@SET 0x004E2CFF, nop
@SET 0x004E2D00, {add esp, 4}
@SJMP 0x004E2D03, 0x004E2D13 ; jmp short
@SET 0x004E2D05, nop

; Load sidebar MIX files for new sides properly
; (enabled until spawner has been reimplemented through Vinifera)
@SET 0x005DD798, {mov cl, byte [0x007E2500]}
@CLEAR 0x005DD79E, 0x90, 0x005DD7A2

; Load speech MIX files for new sides properly
; Defaults SpeechSide to our hijacked player side value
; (enabled until spawner has been reimplemented through Vinifera)
hack 0x005DD75B
mov eax, [Scen]
xor ecx, ecx
mov cl, byte [0x007E2500] ; PlayerSide (was Session.IsGDI)
mov [eax+0x1E44], ecx ; set SpeechSide
jmp 0x005DD784 ; go back to game code for initializing side

;
; The following patches will not be included in Vinifera compatible builds.
;
Expand Down Expand Up @@ -216,33 +239,13 @@ sstring str_TemperatPAL, "TEMPERAT.PAL"
; Remove framework mode mmt/mms loading
@LJMP 0x004F5182, 0x004F528C ; jmp loc_4F528C

; Set global variable byte containing side ID to load files for
@SET 0x004E2CFA, {mov byte [0x7E2500], al}
@SET 0x004E2CFF, nop
@SET 0x004E2D00, {add esp, 4}
@SJMP 0x004E2D03, 0x004E2D13 ; jmp short
@SET 0x004E2D05, nop

; Load sidebar MIX files for new sides properly (for saved games)
@SET 0x005D6C4F, {mov cl, [eax+1D91h]}
@CLEAR 0x005D6C55, 0x90, 0x005D6C58

; Load sidebar MIX files for new sides properly
@SET 0x005DD798, {mov cl, byte [0x007E2500]}
@CLEAR 0x005DD79E, 0x90, 0x005DD7A2

; Load speech MIX files for new sides properly (for saved games)
@SET 0x005D6DCE, {xor ecx, ecx}
@SET 0x005D6DD0, {mov cl, [eax+1D91h]}
@CLEAR 0x005D6DD6, 0x90, 0x005D6DDB

; Load speech MIX files for new sides properly
; Defaults SpeechSide to our hijacked player side value
hack 0x005DD75B
mov eax, [Scen]
xor ecx, ecx
mov cl, byte [0x007E2500] ; PlayerSide (was Session.IsGDI)
mov [eax+0x1E44], ecx ; set SpeechSide
jmp 0x005DD784 ; go back to game code for initializing side

%endif

0 comments on commit a43a285

Please sign in to comment.