Customizing Hide-and-Seek-Mod (General Assembly related Questions)
#1
Hi,

some friends of mine and I have been playing the Hide And Seek mod by CLF78 (https://wiki.tockdom.com/wiki/Hide_and_Seek) and I'm currently trying do adapt the mod to our needs.

I have so far accomplished to change minor things and I want to add another behaviour to the mod. By default the minimap is hidden throughout the rounds - I want the minimap to be seen in the last 20 seconds.

In the source files you will find these lines (src\payload\main\hudedit.S)

Code:
HideHUD:
rlwinm r3, r3, 0, 29, 25
# Show score + Kill Info Text
ori r31, r3, 0x1400

Code:
directWriteBranch(HUDEditsHook, HideHUD, true);

Code:
/* Disable Various HUD Elements */
HUDEditsHook = 0x808562B8;

I'm quite new to assembly and this is what I have though of so far:
The HideHUD is hooked in an adress responsible for changing HUD elements. What I think HideHUD does is taking the value of r3, modifying it and storing the modified value in r31

What I'm not really sure of: is HideHUD then executed once at the beginning or each frame? I have assumed it's executed each frame so what I though of is storing the original value of r3 and later on - when 30 seconds are left to play - , restoring the original r3, adapting the modifications it's been done to and storing it in r31

I have not yet found out the value how to show the minimap only as I wanted to focus on Assembly and logic first. This is what I got so far: (it's not the final code - just some playing around)

Code:
# Turn off position, lap and minimap
HideHUD:
rlwinm r3, r3, 0, 29, 25

# check if register has been backed up
lis r5, HUDBackupSaved@ha
lbz r5, HUDBackupSaved@l(r5)
cmpwi r5, 1
beq+ SkipBackup

# backup register
lis r5, HUDBackup@ha
stw r3, HUDBackup@l(r5)

# backupSaved = 1
li r6, 1
lis r5, HUDBackupSaved@ha
stw r6, HUDBackupSaved@l(r5)

SkipBackup:
# if more then 20 seconds remaining
lis r12, Raceinfo@ha
lwz r12, Raceinfo@l(r12)
lwz r12, 0x20(r12)
cmpwi r12, 1200
bgt+ WithoutMap

# if less than 1 frame remaining
lis r12, Raceinfo@ha
lwz r12, Raceinfo@l(r12)
lwz r12, 0x20(r12)
cmpwi r12, 1
blt+ WithoutMap

WithMap:
# Score + Kill Info + LIVE
lis r5, HUDBackup@ha
lbz r3, HUDBackup@l(r5)
ori r31, r3, 0x1600
blr

WithoutMap:
# Score + Kill Info
ori r31, r3, 0x1400
blr

Would be great if you could give me any tips what to change so the minimap will be visible in the last 20 seconds

Just in case HideHUD is executed only once at the beginning, how could I unhide the minimap then? I have thought about executing the Assembly command from C code when 20 seconds are left to play - is it possible to execute Assembly commands from C?
Reply


Messages In This Thread
Customizing Hide-and-Seek-Mod (General Assembly related Questions) - by tefo7 - 01-25-2023, 08:48 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)