Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RainbowTabitha committed Oct 15, 2024
1 parent 1b83734 commit 816075f
Show file tree
Hide file tree
Showing 11 changed files with 1,615 additions and 3,760 deletions.
65 changes: 65 additions & 0 deletions asm/mp4/MP4 vanilla store playerplace and gamephase.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#To be inserted at 80086480
#Original instruction
lwz r3, 0 (r4)

#Store current player's placement
#Load curplayer index, multiply by 0x30
lis r15, 0x8018
ori r15, r15, 0xFD02
lbz r15, 0 (r15)

mulli r15, r15, 0x30

#Get current player placement
lis r4, 0x8018
ori r4, r4, 0xFC38 #player structs start

add r4, r4, r15 #now points to cur player

lbz r4, 0x0009 (r4) #cur player placement byte
andi. r4, r4, 0x60
srwi r4, r4, 5 #return player placement

lis r15, 0x8018
ori r15, r15, 0xFD62 #Store player placement on 0x8018FD62

sth r4, 0 (r15)

#Store current game phase (00: Early, 01: Mid, 02: Late)
#Get turn data used for the code
lis r14, 0x8018
ori r14, r14, 0xFCFC
lbz r4, 1 (r14) #Max Turn
lbz r14, 0 (r14) #Current Turn

li r14, 3
divw r4, r4, r14 #Divide Max Turn / 3.

lis r14, 0x8018
ori r14, r14, 0xFCFC
lbz r14, 0 (r14) #Current Turn


li r15, 0 #Earlygame byte
cmpw r14, r4
ble set_gamephase

li r15, 1 #Midgame byte

mulli r4, r4, 2
cmpw r14, r4
ble set_gamephase

li r15, 2 #Lategame byte

set_gamephase:

lis r4, 0x8018
ori r4, r4, 0xFD72 #Store gamephase on 0x8018FD72

sth r15, 0 (r4)

li r14, 0
li r15, 0


60 changes: 60 additions & 0 deletions asm/mp4/RandomItems 1to3 Vanilla.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#To be inserted at 80083878
#To be inserted at 80083878
#Item Space weights struct
lis r7, 0x8018
ori r7, r7, 0xFD64

# Calculate the range of random values based on percentages
li r3, 0
li r4, 0

loop_calc:
cmpwi r3, 0xE # Exit at 0xE
beq- exit_calc
lhzx r5, r7, r3 # Load the percentage for the current item using r3 as index
add r4, r4, r5 # Add the percentage to the range of random values
addi r3, r3, 1 # Increment index by 1
b loop_calc
exit_calc:

# Call the random integer function
lis r5, 0x8005
ori r5, r5, 0xFB40 # 0x8005FB40 get rand int function
mtctr r5
mr r3, r4
bctrl

# rand integer in r3 in range of percentages array

# Select the item based on the random integer
li r4, 0
li r5, 0
loop_select:
cmpwi r5, 0xE # Exit at 0xE
beq- exit_select
lhzx r6, r7, r5 # Load the percentage for the current item using r5 as index
sub r3, r3, r6 # Subtract the percentage from the random integer
cmpwi r3, 0 # Compare the updated random integer with 0
bge+ loop_increment # If the updated random integer is greater than or equal to 0, continue to the next item
b exit
loop_increment:
addi r4, r4, 1 #item id increment
addi r5, r5, 1 # Increment index by 1
b loop_select
exit:
lis r5, 0x817F
ori r5, r5, 0xFFF0
stw r4, 0 (r5)
cmpwi r4, 8
blt- skipModelIncrement
#there's a gap in the item models starting at gaddlight's item id (8)
addi r4, r4, 1

skipModelIncrement:
lis r5, 0x0007
ori r5, r5, 0x006d #base item id
add r3, r4, r5
li r4, 0 #restore from hook
li r5, 0 #restore from hook
118 changes: 0 additions & 118 deletions asm/mp8DKEarlyFirstSpaceOdds.asm

This file was deleted.

118 changes: 0 additions & 118 deletions asm/mp8DKEarlyLastSpaceOdds.asm

This file was deleted.

Loading

0 comments on commit 816075f

Please sign in to comment.