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

[New Feature] Support for loading sidebar, speech etc. files for more than 2 factions #218

Open
Rampastring opened this issue May 14, 2021 · 0 comments · May be fixed by #921
Open

[New Feature] Support for loading sidebar, speech etc. files for more than 2 factions #218

Rampastring opened this issue May 14, 2021 · 0 comments · May be fixed by #921
Assignees
Labels
new-feature New feature or request.
Milestone

Comments

@Rampastring
Copy link
Member

Rampastring commented May 14, 2021

Description:

The original game does not properly support loading unique assets of more than 2 factions. CnCNet ts-patches / DTA has many hacks related to fixing this:

; 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 speech MIX files for new sides properly (for saved games)
@SJMP 0x005D6DB8, 0x005D6DCE     ;jmp short

@SET 0x005D6DCE, {xor ecx, ecx}
@SET 0x005D6DD0, {mov cl, [eax+1D91h]}
@CLEAR 0x005D6DD6, 0x90, 0x005D6DDB

; 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
@SET 0x005DD822, {xor ecx, ecx}
@CLEAR 0x005DD822, 0x90, 0x005DD828
@SET 0x005DD82B, {mov cl, byte [0x007E2500]} ; Compile warning: byte value exceeds bounds?

There is also a separate hack in spawner.asm (https://github.com/CnCNet/ts-patches/blob/master/src/spawner/spawner.asm) starting from line 1419 onwards, supposedly GDI needs a value to be 1 in the original game while Nod needs it to be 0, which is the opposite of their side indexes:

    ; Sidebar hack for mods which add new sides and new sidebars for them
    ; this will not fuck invert al which is needed for normal TS sidebar loading
    ; as GDI needs 1 and Nod 0 for sidebar (which is the opposite of their side index)
    SpawnINI_Get_Bool str_Settings, str_SidebarHack, 0
    cmp al, 1
    pop eax
    jz  .Sidebar_Hack

    ; Invert AL to set byte related to what sidebar and speech graphics to load
    cmp al, 1
    jz .Set_AL_To_Zero

    mov al, 1
    jmp .Past_AL_Invert

.Set_AL_To_Zero:
    mov al, 0

.Past_AL_Invert:
.Sidebar_Hack:
    mov byte [0x7E2500], al ; For side specific mix files loading and stuff, without sidebar and speech hack
    mov ebx, [ScenarioStuff]
    mov byte [ebx+1D91h], al

    SpawnINI_Get_Int str_Settings, str_Color, 0
    mov dword [esi+0x39], eax  ; color
    mov dword [PlayerColor], eax

    mov dword [esi+0x41], -1

    mov [TempPtr], esi
    lea eax, [TempPtr]
    push eax
    mov ecx, NameNodeVector
    call NameNodeVector_Add

    mov esp,ebp
    pop ebp
    retn
@Rampastring Rampastring added the new-feature New feature or request. label May 14, 2021
@Rampastring Rampastring added this to the TS-Patches milestone May 14, 2021
@CCHyper CCHyper self-assigned this Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature New feature or request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants