don't click here

Basic Questions & Answers thread

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, May 29, 2008.

  1. Hivebrain

    Hivebrain

    Administrator
    3,048
    160
    43
    53.4N, 1.5W
    Github
    It only needs to loop 4 times. The first bullet is free.
     
  2. Stealth

    Stealth

    Tech Member
    594
    30
    28
    Sonic Mania, HCGE, Sonic Megamix, SonED2, [...]
    You both seem to have missed a few of other issues with it :P

    Code (Text):
    1.                 moveq   #4,d0
    While the loop register setting must be outside of the loop (not to constantly reset and cause an infinite loop), and must be one less than the number of times the code needs to execute (because it executes once before the counter is manipulated at the end), moving that line by itself will create this situation:

    Code (Text):
    1.                 jsr     SingleObjLoad
    2.                 bne.s   Obj43_LoadBullet
    3. Obj43_LoadBullet:
    That's an illegal zero-length branch. And asside from that, the "bne" is meant to prevent the setting of values within a nonexistent object slot. The SingleObjLoad routine scans through the SST for a slot whose Sprite ID is set to 0, and upon finding one, exits, meaning that the condition code is still 0. A nonzero means that the search has run to the end of the list and hasn't found an empty slot. The conditional branch after any SingleObjLoad call should branch past all code that sets the supposedly-spawned object's variables

    Code (Text):
    1.                 move.w  #$300,$10(a1)
    2.                 btst    #0,$22(a1)
    3.                 bne.s   fwaf
    4.                 neg.w   $10(a1)
    5. fwaf:
    6.                 rts
    This code is apparently supposed to set the horizontal velocity of the projectiles, but is executed outside of the loop. Given that I assume each projectile is supposed to be mobile, this code must be executed for all five of them, or it will end up only applying to the last one that was spawned

    Code (Text):
    1.                 dbf     d0,Obj43_Fire
    This being the instruction that actually decrements the counter and jumps back to the beginning of the looped code, it must come AFTER all code that needs to be looped.

    Code (Text):
    1.                 btst    #0,$22(a1)
    Also, given that this is the horizontal flip status bit , and given the code that follows, I assume that it's testing for the bullet's direction to determine leftward or rightward velocity. This code is effectively useless, because when the projectile was spawned, it wasn't given status bit settings. You'd need to do one of two things- either set the projectile's status flags equal to those of the enemy before performing this test, or test the enemy's status flags instead.

    After taking all of that into consideration, your code should look more like this:
    Code (Text):
    1.                 moveq   #4,d0
    2. Obj43_Fire:
    3.                 jsr     SingleObjLoad
    4.                 bne.s   fwaf2
    5. Obj43_LoadBullet:
    6.                 move.b  #$23,(a1)
    7.                 move.w  8(a0),8(a1)
    8.                 move.w  $C(a0),$C(a1)
    9.                
    10.                 move.w  #$300,$10(a1)
    11.                 btst    #0,$22(a0)
    12.                 bne.s   fwaf
    13.                 bset    #0,$22(a1)
    14.                 neg.w   $10(a1)
    15. fwaf:
    16.                 dbf     d0,Obj43_Fire
    17. fwaf2:
    18.                 rts
    There is still an issue, though. All of the projectiles are spawned at the same time, and given the same horizontal velocity, with no vertical velocity set, so they'll overlap and it will give the appearance that there is only one. Solutions would be to vary the horizontal velocities so they fan out horizontally, add varied vertical velocities so they fan out vertically, vary both horizontal and vertical velocity so they fan out in a more angled or circular type pattern (which would look better.. you could use the CalcSine routines to get X and Y velocities from a constant vector velocity and five different angles), or to implement a timer between spawning each of the five projectiles (in which case, this loop needs to be thrown out, and you need something that happens once every few frames). It really depends on how you imagined the concept when you decided to try and implement it
     
  3. Hanoch

    Hanoch

    Also known as TheKnock, Birashot Member
    491
    0
    0
    Israel
    everything
    Ok and if I want it to shoot only 1 bullet, do I change d0 to 1 or 2? Or I just get rid of the loop?

    Edit: Changed to 1 and the game still lagged, removed the loop and I got:

    [​IMG]

    SPECIAL BEAM CANNON!. It looks cool but I don't like it. Behind the beam there's a invisible area and u can still get hurt from touching it.

    Edit2:

    Code (Text):
    1. Obj43_Stop:            ; XREF: Obj43_ChkJump
    2.         tst.b    $32(a0)
    3.         bmi.s    locret_E188
    4.         move.w    ($FFFFD008).w,d0
    5.         subi.w    #$30,d0
    6.         sub.w    8(a0),d0
    7.         bcc.s    locret_E188
    8.         move.b    #0,$1C(a0)
    9.         move.b    #$E,$20(a0)
    10.         clr.w    $10(a0)
    11.         move.w    #120,$30(a0); set waiting time to 2    seconds
    12.         move.b    #8,$25(a0)     ; set routine to fire
    13.         bset    #7,$32(a0)
    14.  
    15. locret_E188:
    16.         rts
    Maybe it has something related for calling the routine?
     
  4. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    485
    63
    italy
    This.
     
  5. Alright, I tried using ESE Sound Importer 0.02 to import some music from Sonic 3 and Knuckles into Sonic 2 for a hack that I just started, and it doesn't seem to be working. It could be some things that I have wrong setup in the game, or maybe it doesn't support this type of porting music, but whatever it is, when I try porting any music it stops all music and sound effects from playing. When I did it with Mystic Cave 2-Player (the one I'm currently trying to replace) it stopped playing when I enter the Options screen. To see if it was the problem, I switched the title screen music and it did the same thing. Is there some sort of special way to set it up to work correctly? Is there a missing step? Or does it not even support the file conversion I'm trying?
     
  6. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    485
    63
    italy
    For one, keep in mind that the songs in Sonic 2 are compressed in the saxman format, so once you convert a song from Sonic 3 you also have to compress it (get TSDC or something); also, if I remember correctly, when you put new music in Sonic 2, you have to make sure that the new file is smaller or equal in size compared to the old one. And I'm not sure if you should update all the pointers, I'm not familiar with that disassembly, I never work with Sonic 2.
     
  7. SephyUK

    SephyUK

    WHY SO CURIOUS? Member
    597
    0
    0
    Qatar
    Some Freakishly Long Anime
    I'm having a spot of trouble here.
    I want to convert an image from a .bmp format to a format which I can use for a splash screen, and I found that using ImaGenesis seems to work, but I'm having a problem with ImaGenesis, and Vista, with runtime errors and the like. So, is there any programs similar that would do the trick? I've tried SonMapEd, but I just cant get it to work for the life of me....
     
  8. Hm, something is definitely wrong with the way I'm porting the music, must be missing a step or doing something wrong. I'm still using ESEII Sound Importer 0.02 to take music straight from Sonic 3 & Knuckles ROM (since the disassembly somehow doesn't come with split) and put AIZ1 music onto MC 2-Player. (part of what I'm doing) Now there's still something obviously wrong, as I check the filesize and it's 1,007 KB compared to the <1 KB the othyers have. I then compress it, but the filesize is still 122 KB large. What am I doing wrong here?
     
  9. Armada

    Armada

    Sometimes I do things Member
    338
    0
    0
    I was messing around with object properties in SonED 2. How can I get the properties from an object in code? I've tried looking in the monitor code, but I'm not sure where to start.
     
  10. Spanner

    Spanner

    The Tool Member
    Compressing wouldn't do anything. Also, there isn't a Sonic 2 option in the music porter.
    By the way, get the latest version of the Esrael Neto Assembler Editor since there may be some updates.
     
  11. Mr. Mash

    Mr. Mash

    All fanbases are awful Member
    1,440
    0
    0
    drawing
    Sorry to butt in, but I've been editing hill top zone in sonEd. I've blanked out layer B and added my own background, but when I play the ROM the background is still a blank flat colour.
    EDIT: odd, it appears when the shaking background kicks in..
     
  12. I thought I might as well have my first post be a question here...

    I'm using SonED2 to make my Sonic 1 Hack (Planned to be called "Sonic 1 Fail") and I get this problem when I start playing in Marble Garden Zone.
    [​IMG]
    I thought I might be able to fix that in SonED2, but... [​IMG]
    Nothing for where Sonic should be, weird... :flunked:

    So, any advice on what to do?
     
  13. Armada

    Armada

    Sometimes I do things Member
    338
    0
    0
    Edit misc/sloc_lvl.bin (or something like that). That holds Sonic's starting location for each act.
     
  14. ...what? :flunked:
    Sorry, I'm kind of new to hacking, and I undestand almost nothing for hacks (which is a reason why my game is called "Sonic 1 Fail" :v: )
     
  15. Armada

    Armada

    Sometimes I do things Member
    338
    0
    0
    In your folder where you split the data from S1, open the misc folder. In a hex editor, open sloc_lev.bin. This file holds the position Sonic starts in for each act in the game. Put a null object (ID 00) at the place you want to start, and look at the coordinate to get an idea of where you want Sonic to start. You can also get the coordinates from debug mode.
     
  16. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    485
    63
    italy
    If you're not familiar with hex editing, you can also look at this.
     
  17. This makes it easier to understand, thanks.
     
  18. Sorry about the double post, I forgot to test it before I replied to it.

    I edit
    ; Zone 3, act 2
    dc.w $50, $EC
    with what?

    Heres a picture showing where I want Sonic to start off with debug mode active. [​IMG]


    Edit:
    ; Zone 2, act 2
    dc.w $50, $EC
    was effecting Labyrinth Zone, not Marble Garen Zone.
    ; Zone 3, act 2
    dc.w $50, $EC
    effects Marble Garden Zone.
     
  19. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    485
    63
    italy
    $30, $28C
     
  20. I think I understand how to do this...
    The first line of the score shows the position, and if I want to work with it for what I asked about before, I had replace the 0030 with $30 and 023C with $23C. So if I first seperate that line into two segments of four figures, the remove all the 0s in the front a put a $ in place of just the first zero, then I have the position, right?
    EX: 034D0002 is the first line for where the score would be, so the position is $34D, $2
    Note: I just put in random numbers to see if it was right or not.