Skip to content

Commit

Permalink
Add "Extremely Easy" difficulty level
Browse files Browse the repository at this point in the history
  • Loading branch information
Rampastring committed Sep 9, 2023
1 parent 7513993 commit 87c9453
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/extra_difficulty.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@

; sizeof(DifficultyClass) == 80
section .bss
ExtremelyEasyDifficultyData RESB 80
VeryEasyDifficultyData RESB 80
AINormalDifficultyData RESB 80

sstring str_ExtremelyEasy, "ExtremelyEasy"
sstring str_VeryEasy, "VeryEasy"
sstring str_AINormal, "AINormal"
sstring str_Easy, "Easy"


; Hack RulesClass::Difficulty to read in the new difficulty setting
hack 0x005CE198
push str_ExtremelyEasy
mov ecx, edi ; CCINIClass pointer
mov edx, ExtremelyEasyDifficultyData
call 0x005CE1E0 ; Difficulty_Get(CCINIClass & ini, DifficultyClass & diff, char const * section)

push str_VeryEasy
mov ecx, edi ; CCINIClass pointer
mov edx, VeryEasyDifficultyData
Expand Down Expand Up @@ -179,13 +186,26 @@ hack 0x004BB479

; Check if the requested difficulty type matches any the difficulty
; values that we should process
; (3 = Very Easy, 1 = AINormal only if the house is an AI house)
; (4 = Extremely Easy, 3 = Very Easy, 1 = AINormal only if the house is an AI house)
cmp edi, 4
je .Extremely_Easy_Diff
cmp edi, 3
je .Very_Easy_Diff
cmp edi, 1
je .AINormal_Diff
jmp .Normal_Code ; if not, jump to original code

.Extremely_Easy_Diff:
; Set the 'difficulty index' of the house to 0 (Hard AI)
mov dword [ecx+58h], 0

; This difficulty level can only show up in MP
Set_Difficulty_Modifiers_Multiplayer ExtremelyEasyDifficultyData

mov eax, [0x0074C488] ; RulesClass pointer
mov edi, 0 ; Hard difficulty
jmp 0x004BB654 ; let the original game code handle the rest

.Very_Easy_Diff:

; Set the 'difficulty index' of the house to 0 (Hard AI)
Expand Down

0 comments on commit 87c9453

Please sign in to comment.