Part of me wants to say the problem there is running out of Megadrive sprites, but I don't know for certain. EDIT: Quoting due to new page.
click on the tile and you will see it on the blue window bar above labeled as Tile: T/N Where T is the current tile and N is the number of tiles in the file.
Well least I know now its not because the tile was beyond $ff, but that still leaves me wondering what the problems is. If it is done by screen mapings, is there not away to do the way I've done it? you know with it all fixed.
I need some help at some maths: I'm trying to make the entire palette black-white on pause. Now I tried to find out how to find the correct grey colour; however, I have no idea. It's somewhere in the middle of all three colours, I.e.: But I can't explain myself how this is getting calculated. Any ideas? (Btw, I posted this here since it's for a hack and not general.)
Are you using sonmaped? If so, I would highly suggest you to use soned2 or hivepal to edit the palette.
What you've got here is called "luma". It's the perceived brightness of a color and is calculated as R*0.30 + G*59 + B*0.11. Using this formula on the RGB values you prvided you get a luma of Y' = 114*0.30 + 81*0.59 + 141*0.11 = 97.5, which is your gray value. Hope that helps.
Sonic Adventure DX Question I was wondering, how easy would it be to replace sounds in Sonic Adventure DX for the PC? I found a DAT file unpacker at the Hacking CulT, but the link I found for the DAT re-packer is long dead. Replacing the raw WAV files doesn't do anything and if you delete the DAT file the WAV file belongs to, it knocks out all those sound effects that belonged to that file (rather than crashing the game, oddly enough), so I'm at a loss as to how to repack the WAVs... Any advice would be great, but a link to the DAT repacker would be even better. Thank in advance! Nevermind. I found it. Apparently, I wasn't looking hard enough. XD
Uhm, I actually didn't mean how to edit the palette, but how to find out the right grey value. Ok, what? So you have a constant formula, R*0.30 + G*59 + B*0.11, which is on every single of the about 16.5M colours the same or just on the example I gave you? Would be nice if you try to make it foolproof. Btw, searched on Google, and found this, but it seems even more complicated than the things you told me...
I'm trying to figure out a problem with an attack code in my game. Basically it plays the animation and moves accordingly, however when I turn or fall off a ledge while doing it, the animations resets rather than continuing. Here is the code if that helps: Code (Text): ; --------------------------------------------------------------------------- ; Subroutine allowing Sonic to attack ; --------------------------------------------------------------------------- ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| Sonic_Hammer: cmp.b #$1F,$1C(a0) bne.s lol7 move.w $14(a0),d0 move.w d0,d1 asr.w #3,d1 sub.w d1,d0 move.w d0,$14(a0) rts lol7: btst #6,($FFFFF603).w; is A button pressed? beq lol ; if not branch move.b #$1F,$1C(a0); show hammer animation move.w $14(a0),d0 btst #0,$22(a0) beq lol8 neg.w d0 lol8: cmp.w #$400,d0 bgt lol move.w #$400,d0 btst #0,$22(a0) beq lol9 neg.w d0 lol9: move.w d0,$14(a0) lol: move.w $10(a0),d0 tst.w d0 bpl label neg.w d0 label: cmpi.w #$600,d0 bgt Sonic_Hammer_Return btst #6,($FFFFF603).w; is A button pressed? beq.b Sonic_Hammer_return; if not, return move.b #$1F,$1C(a0) ; show animation $20 move.w #$BD,d0 jsr (PlaySound_Special).l Sonic_Hammer_return: rts ; End of function Sonic_Hammer I also made alterations to Sonic_MoveLeft and Right for it to work: Code (Text): move.w d0,$14(a0) cmp.b #$1F,$1C(a0); Use attack animation beq lol2 move.b #0,$1C(a0); use walking animation lol2: MoveRight has the same code but with a different named branch. As well as Obj01_NotRight Code (Text): cmp.b #$1F,$1C(a0) beq lol4 move.b #5,$1C(a0); use "standing" animation lol4:
I wasn't really able to get what you want, but: Are you lazy at making correct comments or were you really not knowing what you are doing there? =P Code (Text): move.w d0,$14(a0) cmp.b #$1F,$1C(a0); is animation $1F being showed? beq.s lol2 ; if yes, branch move.b #0,$1C(a0); use walking animation lol2: That should be clearer.
Whoops, a bit of both really, I was just quickly jotting some basic notes so I remember bits, it was done a while after I put it in, I admit I got help for this code, a simplified version had problems so qiuu made an altered one, though I'm not sure what certain parts are (I've probably botched it somewhere).
That formula should work for every color. It's certainly not something I came up with out of the blue. I'm sure you are aware there are diffent ways to represent colors other than RGB, for instance HSL, where you describe a color by its frequency, or which part of the rainbow it comes from, its saturation, which is how far the color is from gray and its lightness, which can be calculated in a number of ways. If you want the brightness value to be what comes closest to what humans perceive as brightness you calculate its luma component, which simply takes into consideration how much each primary color contributes to the perceived brightness of a color. I should also note that technically you want to use luminance, but luma is what gives you the black and white color from your example. If you scroll down a little farther you'll see a link to the article on Luma. You'll want to use Rec. 601 luma.
When I convert something to grayscale I usually just take the average of the R, G, and B values (e.g. (R+G+B)/3). Looks good enough.
Basically what nineko said, it's known as getting the mean of a list of values. take each value and add them to gether, then divide by the number of values you added, so for example: 2, 6, E 2 + 6 = 8 + E = 16 / 3 = 7 now because of the way the genesis/megadrive's VDP works, it NEEDS to be 9-bit 1110 (Or simply an even value), so you can use the "and" command for this, simply "and" E of the value: 7 & E = 6 thus 6 is your closest avarage. ASM example: (d0 = full colour) Code (ASM): ; =========================================================================== ; --------------------------------------------------------------------------- moveq #$00,d1 ; clear d1 move.b d0,d1 ; copy Green and Red of colour to d1 lsr.b #$04,d1 ; get only Green amount move.b d0,d2 ; copy Green and Red of colour to d2 and.b #$0E,d2 ; get only Red amount lsr.w #$08,d0 ; get only Blue amount of d0 add.b d1,d0 ; add Green amount to Blue amount add.b d2,d0 ; then add Red to the amount divu.w #$03,d0 ; divide by 3 and.b #$0E,d0 ; keep it an even value (Keep 9-bit VDP) move.b d0,d1 ; copy to d1 lsl.b #$04,d1 ; shift to left nybble add.b d1,d0 ; add to d0 (Setting the green) lsl.w #$04,d1 ; shift to next left nybble add.w d1,d0 ; add to d0 (Setting the blue) ; --------------------------------------------------------------------------- ; =========================================================================== d0 now equals greyscale colour (If I've made a mistake here somewhere, or any of you feel it could be optimized better, then feel free to correct it)
Code (ASM): Pal_MakeBlackWhite: lea ($FFFFFB00).w,a0 ; get palette moveq #0,d3 ; clear d3 move.b #$3F,d3 ; set d3 to $3F (+1 for the first run) Pal_MBW_Loop: moveq #0,d0 ; clear d0 move.w (a0),d0 ; get colour moveq #0,d1 ; clear d1 move.b d0,d1 ; copy Green and Red of colour to d1 lsr.b #4,d1 ; get only Green amount move.b d0,d2 ; copy Green and Red of colour to d2 and.b #$E,d2 ; get only Red amount lsr.w #8,d0 ; get only Blue amount of d0 add.b d1,d0 ; add Green amount to Blue amount add.b d2,d0 ; then add Red to the amount divu.w #3,d0 ; divide by 3 and.b #$E,d0 ; keep it an even value (Keep 9-bit VDP) move.b d0,d1 ; copy to d1 lsl.b #4,d1 ; shift to left nybble add.b d1,d0 ; add to d0 (Setting the green) lsl.w #4,d1 ; shift to next left nybble add.w d1,d0 ; add to d0 (Setting the blue) move.w d0,(a0)+ ; set new colour dbf d3,Pal_MBW_Loop ; loop for each colour rts ; return This worked just fine. Big thanks (the rest of my questions I will tell you on IRC =P).
Getting back into the hacking thing here, or trying to. I'm running Ubuntu now, and I can't seem to get the Sonic 2 2007 disassembly to build with the Linux build tools from the wiki. Code (Text): ~/s2hax$ sh build linux/asl: relocation error: linux/asl: symbol __guard, version GLIBC_2.3.2 not defined in file libc.so.6 with link time reference What have I done wrong, and how can I fix it?
Okay I've tried editing Sonic's title sprites on SonMapEd but when I save the thing onto the ROM I get the error message Code (Text): bsr.w MvSonicOnPtfm s1comb.asm(21857) : Error 06054 : Branch offset (0xffff7fc6) out of range 1 error encountered processing file 's1comb.asm' 36892 source statements in 47397 lines processed in 0.7 seconds Anyone know what the problem might be here?
Okay tried that (had to change several lines plus MvSonicOnPtfm2 it seems), now I'm getting this error: Code (Text): s1comb.asm(6211) : Error 06052 : Branch offset (-32956) out of range at address 0 s1comb.asm(6224) : Error 06052 : Branch offset (-32930) out of range at address 0