Banner
Views: 934,406,855
Time:
20 users online: 2hh8899, Airik2112, Anas, Dark Prince, dougeff, Galactic Spear, h.carrell,  K.T.B., LucasRCD, Luis Carrasquero, medrano, Mrmightymouse, Ondore's Lies, OrangeBronzeDaisy, qantuum,  RussianMan, Segment1Zone2, Sir_Danny_TM, VLSkoot, Yoshi Master - Guests: 103 - Bots: 126 Users: 52,124 (2,116 active)
Latest: AmnesiaSilence
Tip: If you want to remove patches from your ROM, it is best to either use the restore function, or port everything to a clean ROM.
Not logged in.
Changing Mario's behavior's based on star count
Forum Index - Non-SMW Hacking - Super Mario 64 Hacking - ASM & Data Repository - Changing Mario's behavior's based on star count
Pages: « 1 » Link
Basically, I want to restrict what Mario can do based on how many stars have been collected. Specifically, prevent him from punching till he gets one star, prevent him from diving till he gets two, prevent single jumps till three, and so on. How would I go about doing this, or learning how to do this? I've watched a bunch of tutorials but I can't wrap my head around this.
update: I have code now, and it seems like it should work, but it just lets Mario walk during text. It doesn't prevent him from punching.
Code
.orga 0x861c0
ADDIU SP, SP, 0xFFE8
SW RA, 0x14(SP)

LUI T0, 0x8034 //sets T0 to 0x80340000
ADDIU T1, R0, 0x1 //adds R0, or 0, because it needs it, to T1 with 0x1, or 1 in decimal
SB T1, 0xB21D(T0) //saves byte T1 to address 0xB218, or lives, with T0, or 1

LH T2, 0x8033B21A 
LI T0, 1
lh t3, 0x8033afa2
Andi t3, t3, 0x8000 
Beqz t3, noBpress
NOP
BLT T2, T0, stop
NOP
b noBpress
stop:
LUI T3, 0x8034
LW T4, 0xB17C(T3) //T4 = mario's current state
LI T5, 0x4000445 // T5 = mario stop behavior
SW T5, 0xB17C(T3)
NOP
noBpress:
NOP

LW RA, 0x14(SP)
JR RA
ADDIU SP, SP, 0x18


The first and last chunk are wrappers, while the second is for infinite lives. The third one is what actually changes the behavior.
Well, I worked as much as I could on this last night and this morning and got somewhere. If someone else wants to use the code, here it is:
Code
.headersize 0x80245000

; notes about the spaces to put code in
; there is space in rom from 0x7cc6c0 to 0x800000
; there is space in ram from 0x80367500 to 0x80378700 (can fit in 17536 lines)

.definelabel code_rom, 0x7cc6c0; where your code goes in the rom
.definelabel code_ram, 0x80367500; where your code goes in the ram

.orga 0x396c; here it copies code into the ram at start up
li a0, code_ram
li a1, code_rom
li.u a2, code_end_copy
jal 0x80278504
li.l a2, code_end_copy
jal execonce
nop

.orga 0xfd354
jal execeveryframe
nop

.orga 0xde270; responsible for running every VI frames
b 0x803232a4
sw t4, 0x7110(at)
.skip 28
lw ra, 0x1c(sp)
lw s0, 0x18(sp)
jr ra
addiu sp, sp, 0x38
lb s7, code_ram
nop
beqz s7, @@skip_vi_frames
nop
add s5, r0, ra
jal execviframes
nop
@@skip_vi_frames:
b 0x80323278
lui at, 0x8036

.headersize (code_ram - code_rom)

.orga code_rom
execonce:
addiu sp, sp, 0xffec; don't get rid of those extra things. they are needed
sw a0, 0x4(sp)
sw a1, 0x8(sp)
sw ra, 0xc(sp)

NOP
; executes once here at start up

lw a0, 0x4(sp); don't get rid of those extra things. they are needed
lw a1, 0x8(sp)
or a0, r0, r0
jal 0x80277ee0
lui a1, 0x8000
lui a0, 0x8034
lui a1, 0x8034
addiu a1, a1, 0xb044
addiu a0, a0, 0xb028
jal 0x803225a0
addiu a2, r0, 0x1
lw ra, 0xc(sp)
jr ra
addiu sp, sp, 0x14

execeveryframe:
addiu sp, sp, 0xffe8; don't get rid of those extra things. they are needed
sw ra, 0x14(sp)

LH T2, 0x8033B21A //sets T2 to current star count
LW T6, 0x8033B17C //sets T6 to mario's current behavior
punch:
LI T0, 1 //sets T0 to needed stars
LI T3, 0x00800380 //sets T3 to punch behavior
BEQ T6, T3, act
NOP
LI T3, 0x00800457 //sets T3 to running punch behavior
BEQ T6, T3, act
NOP
jump:
LI T0, 2 //sets T0 to needed stars
LI T3, 0x03000880 //sets T3 to jump behavior
BEQ T6, T3, act
NOP
longJump:
LI T0, 3 //sets T0 to needed stars
LI T3, 0x03000888 //sets T3 to long jump behavior
BEQ T6, T3, act
NOP
sideJump:
LI T0, 4 //sets T0 to needed stars
LI T3, 0x01000887 //sets T3 to side jump behavior
BEQ T6, T3, act
NOP
doubleJump:
LI T0, 5 //sets T0 to needed stars
LI T3, 0x04000472 //sets T3 to double jump behavior
BEQ T6, T3, act
NOP
dive:
LI T0, 6 //sets T0 to needed stars
LI T3, 0x0188088A //sets T3 to dive behavior
BEQ T6, T3, act
NOP
LI T3, 0x018008AA //sets T3 to sliding kick behavior
BEQ T6, T3, act
NOP
groundPound:
LI T0, 7 //sets T0 to needed stars
LI T3, 0x008008A9 //sets T3 to groundPound behavior
BEQ T6, T3, act
NOP
hitWall:
LI T0, 8 //sets T0 to needed stars
LI T3, 0x010208B6 //sets T3 to wall hit behavior
BEQ T6, T3, act
NOP
b noAct
NOP
act:
BLT T2, T0, stop
NOP
BEQ T3, 0x00800380, jump
NOP
BEQ T3, 0x03000880, longJump
NOP
BEQ T3, 0x03000888, sideJump
NOP
BEQ T3, 0x01000887, doubleJump
NOP
BEQ T3, 0x04000472, dive
NOP
BEQ T3, 0x0188088A, groundPound
NOP
BEQ T3, 0x008008A9, hitWall
NOP
stop:
LUI T3, 0x8034
LW T4, 0xB17C(T3) //T4 = mario's current state
LI T5, 0x00020463 // T5 = mario knocked down behavior
SW T5, 0xB17C(T3)
NOP
BEQ T3, 0x00800380, jump
NOP
BEQ T3, 0x03000880, longJump
NOP
BEQ T3, 0x03000888, sideJump
NOP
BEQ T3, 0x01000887, doubleJump
NOP
BEQ T3, 0x04000472, dive
NOP
BEQ T3, 0x0188088A, groundPound
NOP
BEQ T3, 0x008008A9, hitWall
NOP
noAct:
NOP



addiu t6, r0, 0x1; don't get rid of those extra things. they are needed
lui at, 0x8039
lw ra, 0x14(sp)
jr ra
addiu sp, sp, 0x18

execviframes:
addiu sp, sp, 0xffe8
sw ra, 0x18(sp)
sw s5, 0x14(sp)

NOP
; your code that runs every vi frame here

lw ra, 0x18(sp)
addiu sp, sp, 0x18
jr ra
lw ra, 0x14(sp)

code_end:
.definelabel code_end_copy, (code_end - (code_ram - code_rom))

my main issues were the size of my code, but the worlds largest wrapper fixed that. Everything below "execeveryframe:" and above "addiu t6, r0, 0x1" are my custom code, everything else is a hook that actually allows the code to run without breaking the memory of the game. Changing the behaviors and needed stars is pretty simple, anything else and you're on your own, but hopefully this helps someone and they don't have to work for eight hours for such a simple change.
Since the release of SM64decomp, ASM Hacking kinda became redundant in the SM64 Hacking world (although ASM knowledge is still necessary in some aspects of SM64 Hacking). I recommend learning C and start hacking SM64 with the decomp.
Pages: « 1 » Link
Forum Index - Non-SMW Hacking - Super Mario 64 Hacking - ASM & Data Repository - Changing Mario's behavior's based on star count

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2021 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy
  • sm64romhacks