Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    I have been changing the way Sonic stands on the Tornado, not wanting him to go into his running animation when moving. To do this I have made a new animation script and added the necessary checks to see if it is SCZ at the start of Sonic_Animate. The script is as follows:


    ; ---------------------------------------------------------------------------
    ; Animation script - Sonic on the Tornado
    ; (many of these point to the data above this)
    ; ---------------------------------------------------------------------------
    SonicTornadoAniData: offsetTable
    offsetTableEntry.w SonTornAni_Walk ; 0 ; 0
    offsetTableEntry.w SonTornAni_Run ; 1 ; 1
    offsetTableEntry.w SonAni_Roll ; 2 ; 2
    offsetTableEntry.w SonAni_Roll2 ; 3 ; 3
    offsetTableEntry.w SonAni_Push ; 4 ; 4
    offsetTableEntry.w SonTornAni_Stand ; 5 ; 5
    offsetTableEntry.w SonAni_Balance ; 6 ; 6
    offsetTableEntry.w SonTornAni_LookUp ; 7 ; 7
    offsetTableEntry.w SonTornAni_Duck ; 8 ; 8
    offsetTableEntry.w SonAni_Spindash ; 9 ; 9
    offsetTableEntry.w SonAni_Blink ; 10 ; $A
    offsetTableEntry.w SonAni_GetUp ; 11 ; $B
    offsetTableEntry.w SonAni_Balance2 ; 12 ; $C
    offsetTableEntry.w SonAni_Stop ; 13 ; $D
    offsetTableEntry.w SonAni_Float ; 14 ; $E
    offsetTableEntry.w SonAni_Float2 ; 15 ; $F
    offsetTableEntry.w SonAni_Spring ; 16 ; $10
    offsetTableEntry.w SonAni_Hang ; 17 ; $11
    offsetTableEntry.w SonAni_Dash2 ; 18 ; $12
    offsetTableEntry.w SonAni_Dash3 ; 19 ; $13
    offsetTableEntry.w SonAni_Hang2 ; 20 ; $14
    offsetTableEntry.w SonAni_Bubble ; 21 ; $15
    offsetTableEntry.w SonAni_DeathBW ; 22 ; $16
    offsetTableEntry.w SonAni_Drown ; 23 ; $17
    offsetTableEntry.w SonAni_Death ; 24 ; $18
    offsetTableEntry.w SonAni_Hurt ; 25 ; $19
    offsetTableEntry.w SonAni_Hurt ; 26 ; $1A
    offsetTableEntry.w SonAni_Slide ; 27 ; $1B
    offsetTableEntry.w SonAni_Blank ; 28 ; $1C
    offsetTableEntry.w SonAni_Balance3 ; 29 ; $1D
    offsetTableEntry.w SonAni_Balance4 ; 30 ; $1E
    offsetTableEntry.w SupSonAni_Transform ; 31 ; $1F
    offsetTableEntry.w SonAni_Lying ; 32 ; $20
    offsetTableEntry.w SonAni_LieDown ; 33 ; $21
    offsetTableEntry.w SonAni_StrikeDashBuild ; 34 ; $22
    SonTornAni_Walk:
    SonTornAni_Run:
    SonTornAni_Stand:
    SonTornAni_Duck:
    SonTornAni_Lookup: dc.b 1,$D2,$D3,$FF
    even 
    Now when I build I get several seemingly unrelated errors:


    > > >s1.sounddriver.asm(361): error: addressing mode not allowed on 68000
    > > > move.w FM_Notes(pc,d5.w),d6 ; Clownacy | Doesn't need the lea now that the table's over here
    > > >s1.sounddriver.asm(361): error: addressing mode not allowed here
    > > > move.w FM_Notes(pc,d5.w),d6 ; Clownacy | Doesn't need the lea now that the table's over here
    > > >s1.sounddriver.asm(727): error: addressing mode not allowed on 68000
    > > > jmp Sound_ExIndex(pc,d7.w)
    > > >s1.sounddriver.asm(727): error: addressing mode not allowed here
    > > > jmp Sound_ExIndex(pc,d7.w)
    > > >s1.sounddriver.asm(1152): error: addressing mode not allowed on 68000
    > > > movea.l SFX_SFXChannelRAM(pc,d3.w),a5
    > > >s1.sounddriver.asm(1152): error: addressing mode not allowed here
    > > > movea.l SFX_SFXChannelRAM(pc,d3.w),a5
    > > >s1.sounddriver.asm(1919): error: addressing mode not allowed on 68000
    > > > move.w PSGFrequencies(pc,d5.w),$10(a5) ; Set new frequency
    > > >s1.sounddriver.asm(1919): error: addressing mode not allowed here
    > > > move.w PSGFrequencies(pc,d5.w),$10(a5) ; Set new frequency
    > > >s1.sounddriver.asm(2146): error: addressing mode not allowed on 68000
    > > > jmp coordflagLookup(pc,d5.w)
    > > >s1.sounddriver.asm(2146): error: addressing mode not allowed here
    > > > jmp coordflagLookup(pc,d5.w)
    > > >s1.sounddriver.asm(2453): error: addressing mode not allowed on 68000
    > > > move.b FMSlotMask(pc,d4.w),d4 ; Get slot mask for algorithm
    > > >s1.sounddriver.asm(2453): error: addressing mode not allowed here
    > > > move.b FMSlotMask(pc,d4.w),d4 ; Get slot mask for algorithm
     
    Anybody have any idea why this is happening?
     
    Last edited by a moderator: Feb 14, 2015
  2. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    (The file's still named 's1.sounddriver.asm'? v2.2.5's been out since December.)

    With what information you've given, I can't recreate the error. Anything else?
     
  3. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Oh I hadn't noticed that. I've now updated to v2.2.5.

    Fixed it by adding the animation to every line, as the assembler didn't like my laziness.

    Now that that is sorted would there be anyway to test if Sonic is standing on the tornado or not? It looks kinda silly when Sonic is standing on the Turtle badniks. 
     
    Last edited by a moderator: Feb 14, 2015
  4. Psi

    Psi Well-Known Member Member

    Joined:
    Dec 20, 2014
    Messages:
    102
    Does anyone know where the coding is in S3+K's ASM for the Sandopolis Act 2 ending cutscene? I'm having a problem in that I've reprogrammed the A button, so if the character is on the left of the capsule, when it automatically leaves, it performs a different move rather than jumping, meaning it can't leave. I need to recode it to replicate a B or C press instead, but can't find the coding anywhere.
     
    Last edited by a moderator: Feb 15, 2015
  5. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    When using XM3SMPS/Oerg, whenever I convert a song with PSG's in it, when there's a moment without a PSG playing, the PSG's will play and hold on a note until they start playing again and it ruins the song. Is there anyway to stop this from happening?

    @Psi: Sonic 3K isn't a very well known game and not many users will know this kind of stuff. I'm sure you knew that already but I'm just letting you know. Maybe Varion Icaria would know.
     
  6. Psi

    Psi Well-Known Member Member

    Joined:
    Dec 20, 2014
    Messages:
    102
    I know. But there's no harm asking.....again...and again...and again..... :suicide:
     
  7. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    Keep in mind that I'm saying this without having ever looked at the disassembly, but I wouldn't expect it to be specific to Sandopolis, since there are other places where you can end at the left of a capsule and you automatically jump to perform the following cutscene (e.g. Marble Garden 2 with Knuckles (or with Sonic if you know how to get him there), or Flying Battery 2 with anyone). Furthermore, there are other instances of automatic jumps in other cutscenes, for example in Sandopolis 1 if you obtain any monitor via signpost bouncing and you get to the left of them without breaking them before the score tally begins. My bet is that there is some generic check in a common cutscene code, "if stuck then jump" or something.


    But I might be entirely wrong. This is a wildly random guess.
     
    Last edited by a moderator: Feb 15, 2015
  8. Psi

    Psi Well-Known Member Member

    Joined:
    Dec 20, 2014
    Messages:
    102
    Little of S3+K is labelled as thoroughly. I seem to be finding some automatic actions but they're labelled differently from the previous disassemblies, having three number bytes instead of four, cases such "#$404, (Ctrl_1..." or even "#$808, (Ctrl_1..." (?). Anyone know how these work?
     
    Last edited by a moderator: Feb 16, 2015
  9. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    I want to switch GHZ's palette cycling to GHZ's background/secondary palette instead of the foreground/primary palette but I can't figure out how to do it. Does someone know how it can be done?

    Here is GHZ's palette cycling code for Hivebrain's disassembly just in case you don't want to go through a disassembly to find it:

    Code:
    PalCycle_GHZ:				; XREF: PalCycle
    		lea	(Pal_GHZCyc).l,a0
    
    loc_196A:				; XREF: PalCycle_Title
    		subq.w	#1,($FFFFF634).w
    		bpl.s	locret_1990
    		move.w	#3,($FFFFF634).w
    		move.w	($FFFFF632).w,d0
    		addq.w	#1,($FFFFF632).w
    		andi.w	#3,d0
    		lsl.w	#3,d0
    		lea	($FFFFFB50).w,a1
    		move.l	(a0,d0.w),(a1)+
    		move.l	4(a0,d0.w),(a1)
    
    locret_1990:
    		rts	
    
     
  10. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Sonic 1 stores it's palettes in $FB00-$FB7F (at least according to Sonic retro's ram page), and the only line I see fitting that description is


    lea ($FFFFFB50).w,a1

    Try playing with the called ram address, and see if it shifts the palette cycle around (remember to not use odd addresses; that results in the hack becoming incompatible with hardware, which can be rather annoying to fix).
     
    Last edited by a moderator: Feb 17, 2015
  11. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Double post.... Sorry....

    Anyways, I made some hackish code which detects if the player is touching it, and if the player is, it runs my custom code instead of continuing the normal collision routines. I did this by setting a flag in the object I'm using before and after the SolidObject routine, as below:


    move.w #1,($FFFFFAEE).w ;move 1 to collide w/emerald check
    jsr SolidObject
    move.w #0,($FFFFFAEE).w ;reset collide w/emerald check

    Later on in SolidObject, it preforms this check:


    loc_19A2E:
    cmpi.w #1,($FFFFFAEE).w ;test for HPZ emerald flag
    beq.w HPZportal ;if standing on HPZ emerald, branch

    Thankfully, it's been working ever since the earliest builds of my hack, but it suffers a serious issue: Tails in 2P mode can trigger it, which is not intentional at all, and can lead to general confusion on the players part. How would I fix it so that only the first player runs this code?

    EDIT: This issue has been resolved.
     
    Last edited by a moderator: Feb 20, 2015
  12. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Have you tried taking a look at how Monitors do it? AI Tails can't break them.
     
  13. Psi

    Psi Well-Known Member Member

    Joined:
    Dec 20, 2014
    Messages:
    102
    Wait are you trying to program some effect when the player jumps onto the Hidden Palace emerald? Can we talk? :D
     
    Last edited by a moderator: Feb 20, 2015
  14. JoenickROS

    JoenickROS ROS (bug fixing in progress) Member

    Joined:
    Feb 5, 2012
    Messages:
    929
    Alright Pacguy, you went about this with too much thought, in the area of your object code for the solidity check, it just needs this somewhere in it.


    lea (maincharacter).w,a1 , Load Maincharacter into a1 if they are not already.
    btst #3,status(a1) , check if the maincahracter is standing on the emerald, at a1.
    bne.s HPZportal ; go to warp code if Sonic/maincahracter is.

    This way, you don't have to add a new RAM address, and the sidekick/Tails will not activate it.

    Edit: I mean yours works, but it wastes some processing time.
     
    Last edited by a moderator: Feb 21, 2015
  15. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    With the way my level is designed, I want hitting it from any direction to work, so I'm afraid that isn't feasible for me, Joenick. It sucks, too, that code looks so small and simple incomparison to the hunk that is SolidObject, and it would save me that ram flag...
     
  16. JoenickROS

    JoenickROS ROS (bug fixing in progress) Member

    Joined:
    Feb 5, 2012
    Messages:
    929
    Whoops, I must have missed the hit anywhere part, sorry about that.

    Edit: Wait, then do #5,status(a1), is Sonic pushing on the object, for the check.
     
    Last edited by a moderator: Feb 21, 2015
  17. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I recently made my own tails flight code by disecting selbi's jumpdash code again, which I'm very proud of. The thing is, while it works wonderfully in singleplayer, in coop mode, CPU tails can accidently start flying for no reason, which is obviously a bit annoying. What check could I add in front of my tails flight code to prevent tails from flying under CPU control, but allow players to activate flight mode? (I want it to work in both coop and singleplayer; so a simple check of which character option is selected won't do)
     
  18. JoenickROS

    JoenickROS ROS (bug fixing in progress) Member

    Joined:
    Feb 5, 2012
    Messages:
    929
    Simple, check if Tails is the main character and if he's not then if he is the cpu/sidekick he won't fly.
     
    Last edited by a moderator: Feb 21, 2015
  19. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I need it to work in coop mode, where he's in the second slot and can still potentially be controlled by the player :p
     
  20. JoenickROS

    JoenickROS ROS (bug fixing in progress) Member

    Joined:
    Feb 5, 2012
    Messages:
    929
    Yeah but aren't you having them switch addresses if the sidekick starts being controlled?
     
    Last edited by a moderator: Feb 21, 2015