Aug 4, 2011 at 3:44 AM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
gamefreak11221 said:
So it needs mimiga mask? I'll leave it what it looks like 'cuz i'm not going to use the mimiga mask on my total conversion mod...
Actually, I don't think it requires that your character actually possesses the mimiga mask item; rather, there is a flag that the game sets when you put the mimiga mask on that changes your character image. You could change the flag in response to any stimula you like.
 
Aug 4, 2011 at 12:13 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3054
Exactly!
I used it once to create a different sprite while swimming, but you could also make it into a "oh noez, I got hit" image or whatever you wanted.
 
Aug 5, 2011 at 6:09 AM
Junior Member
"Fresh from the Bakery"
Join Date: Apr 24, 2011
Location:
Posts: 13
I'm using the deluxe package so any prob w/ it? And i liked the game also not that i've finished it but the graphics
 
Aug 5, 2011 at 6:40 AM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
gamefreak11221 said:
I'm using the deluxe package so any prob w/ it? And i liked the game also not that i've finished it but the graphics

p198544-0-doctorjack.png

there is no problem with the deluxe package
 
Aug 5, 2011 at 12:16 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3054
What the hell was that first picture
 
Aug 8, 2011 at 9:12 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3054
Why is drawing blits faster than drawing a corresponding amount of individual pixels?
 
Aug 8, 2011 at 9:50 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Lace said:
Why is drawing blits faster than drawing a corresponding amount of individual pixels?

http://en.wikipedia.org/wiki/Bit_blit

Now, I have never personally worked with a graphics driver, mainly because modern operating systems generally don't let you mess with the display screen except by calling system functions. But I think I remember enough from my calculator hacking days to explain why drawing one pixel at a time is slow.

Sean said:
A horizontal line could be drawn by a loop of GetPixels, but that is way too slow.

Code:
[B]This is written in z80 assembly, not x86![/B]

Now it's time for some fun. Here is an XOR sprite routine with full clipping, and wrapped up in a program to boot
(it's big, but all you really care about is the actual routine).
The core of the SDR has changed only slightly to accomodate horizontal clipping.
Program 25-1
        b_call(_RunIndicOff)
        b_call(_GrBufClr)

Show:
        CALL    PutSpr
        b_call(_GrBufCpy)

KeyLoop:
        b_call(_GetKey)
        CP      kClear
        RET     Z

        CP      kUp
        JR      Z, MoveUp
        CP      kDown
        JR      Z, MoveDown
        CP      kLeft
        JR      Z, MoveLeft
        CP      kRight
        JR      NZ, KeyLoop

; Move sprite right
        CALL    PutSpr          ; Erase sprite
        LD      HL, xpos
        INC     (HL)
        JR      Show            ; Draw sprite at new location

MoveLeft:
; Move sprite left
        CALL    PutSpr
        LD      HL, xpos
        DEC     (HL)
        JR      Show

MoveUp:
; Move sprite up
        CALL    PutSpr
        LD      HL, ypos
        DEC     (HL)
        JR      Show

MoveDown:
        CALL    PutSpr
        LD      HL, ypos
        INC     (HL)
        JR      Show

ypos:   .DB     0
xpos:   .DB     0

sprite:
        .DB     %10000001
        .DB     %11000011
        .DB     %01100110
        .DB     %00111100
        .DB     %00111100
        .DB     %01100110
        .DB     %11000011
        .DB     %10000001

PutSpr:
        LD      DE, (ypos)
        LD      IX, sprite
        LD      B, 8

ClipSprXOR:
; D = xpos
; E = ypos
; B = height
; IX = image address
; Start by doing vertical clipping
    LD     A, %11111111         ; Reset clipping mask
    LD     (clip_mask), A
    LD     A, E                 ; If ypos is negative
    OR     A                    ; try clipping the top
    JP     M, ClipTop           ;
 
    SUB    64                   ; If ypos is >= 64
    RET    NC                   ; sprite is off-screen

    NEG                         ; If (64 - ypos) > height
    CP     B                    ; don't need to clip
    JR     NC, VertClipDone     ; 

    LD     B, A                 ; Do bottom clipping by
    JR     VertClipDone         ; setting height to (64 - ypos)

ClipTop:
    LD     A, B                 ; If ypos <= -height
    NEG                         ; sprite is off-screen
    SUB    E                    ;
    RET    NC                   ;

    PUSH   AF
    ADD    A, B                 ; Get the number of clipped rows
    LD     E, 0                 ; Set ypos to 0 (top of screen)
    LD     B, E                 ; Advance image data pointer
    LD     C, A                 ;
    ADD    IX, BC               ;
    POP    AF
    NEG                         ; Get the number of visible rows
    LD     B, A                 ; and set as height

VertClipDone:
; Now we're doing horizontal clipping
    LD     C, 0                 ; Reset correction factor
    LD     A, D

    CP     -7                   ; If 0 > xpos >= -7
    JR     NC, ClipLeft         ; clip the left side

    CP     96                   ; If xpos >= 96
    RET    NC                   ; sprite is off-screen

    CP     89                   ; If 0 <= xpos < 89
    JR     C, HorizClipDone     ; don't need to clip

ClipRight:
    AND    7                    ; Determine the clipping mask
    LD     C, A
    LD     A, %11111111
FindRightMask:
    ADD    A, A
    DEC    C
    JR     NZ, FindRightMask
    LD     (clip_mask), A
    LD     A, D
    JR     HorizClipDone

ClipLeft:
    AND    7                    ; Determine the clipping mask
    LD     C, A
    LD     A, %11111111
FindLeftMask:
    ADD    A, A
    DEC    C
    JR     NZ, FindLeftMask
    CPL
    LD     (clip_mask), A
    LD     A, D
    ADD    A, 96                ; Set xpos so sprite will "spill over"
    LD     C, 12                ; Set correction

HorizClipDone:
; A = xpos
; E = ypos
; B = height
; IX = image address

; Now we can finally display the sprite.
    LD     H, 0
    LD     D, H
    LD     L, E
    ADD    HL, HL
    ADD    HL, DE
    ADD    HL, HL
    ADD    HL, HL

    LD     E, A
    SRL    E
    SRL    E
    SRL    E
    ADD    HL, DE

    LD     DE, PlotSScreen
    ADD    HL, DE

    LD     D, 0                 ; Correct graph buffer address
    LD     E, C                 ; if clipping the left side
    SBC    HL, DE               ;

    AND    7
    JR     Z, _Aligned

    LD     C, A
    LD     DE, 11

_RowLoop:
    PUSH   BC
    LD     B, C
    LD     A, (clip_mask)       ; Mask out the part of the sprite
    AND    (IX)                 ; to be horizontally clipped
    LD     C, 0

_ShiftLoop:
    SRL    A
    RR     C
    DJNZ   _ShiftLoop

    XOR    (HL)
    LD     (HL), A

    INC    HL
    LD     A, C
    XOR    (HL)
    LD     (HL), A

    ADD    HL, DE
    INC    IX
    POP    BC
    DJNZ   _RowLoop
    RET

_Aligned:
    LD     DE, 12

_PutLoop:
    LD     A, (IX)
    XOR    (HL)
    LD     (HL), A
    INC    IX
    ADD    HL, DE
    DJNZ   _PutLoop
    RET

clip_mask:      .DB     0

So as you can see this z80 sprite drawing routine is very similar in concept to the x86 stuff. JR NZ is the same as x86's JNZ and CP is the same as CMP. HL and IX are registers, just to name a couple.

Because the blitting technique uses XOR, AND, OR, and NOT to load sprites directly onto some grid of bytes which will be "displayed" into the screen, it's much faster than calling a single ChangePixel() function over and over again. At the very least, modern routines use some sort of psuedo-XOR, psuedo-AND, and other weirdo bit manipulation techniques to do this. With the bitwise instructions, there is much less stack space, less jumps, and less calls in general. So that's why blitting is faster than drawing individual pixels.

*This information was brought to you by Learn TI-83 Plus Assembly In 28 Days by Sean McLaughlin: The number one resource for transforming your Texas Instruments graphing calculator into a gaming platform*
 
Aug 10, 2011 at 5:24 PM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
LunarSoul said:
Works perfectly.
One more question. Where is the key_pressed code for "W' stored? I want it to call an event, and I need to know where it is checked.

I guess no one saw this.
I want to make the map button ("W") call an event in head.tsc. I know how to use the call event function, but I need to know where the code checks for "W".
 
Aug 10, 2011 at 6:26 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
LunarSoul said:
I guess no one saw this.
I want to make the map button ("W") call an event in head.tsc. I know how to use the call event function, but I need to know where the code checks for "W".

LunarSoul, if you're going to do these kinds of things, then you should probably learn how to find your own ASM offsets. Not only is this extremely useful, it can also save you at a time when the assembly compendium does not have the information you want.

This is how I found where the code "checks" for W.

First I jumped to the beginning of the TSC parser at address 422510. This offset is inside the ASM compendium.

Next I wanted to find <MLP, which is a TSC command that shows the minimap. Of the 3 letters M, L, and P, it seems that L is the least commonly used among the TSC commands (maybe I miscounted, but whatever). So I used Right-Click > Search For > Constant, and then typed in 4C, which is the ASCII code for the letter L.

Eventually I found <MLP:

00424408 = <MLP

<MLP will call a function at 00414640. This probably "shows the map". I Ctrl+G'd over to 414640.

Using Right-click > Find References to > Selected Command on the first instruction at 414640, you can see that function 414640 is called at 410785 and 42444C.
The second one is obviously in the parser, but the first could be where the game has already checked for W and is ready to render the map graphics.

And indeed it is. Here is the code where the game checks for W.

Code:
Address   Command                                  Comments
00410768  |MOV ECX,DWORD PTR DS:[49E214]           ;Get code for KeyPressed.
0041076E  |AND ECX,DWORD PTR DS:[493624]           ;Check KeyPressed code to see if Map Button was pressed.
00410774  |JE SHORT 004107AC                       ;If not, jump somewhere else.
00410776  |PUSH OFFSET 0048F91C                    ;Push FullScreenRect
0041077B  |PUSH 0A
0041077D  |CALL 0040C320                           ;Some function?
00410782  |ADD ESP,8
00410785  |CALL 00414640                           ;If yes, then call the "show minimap" function.

That's the code you want to modify. It would have been faster to search for the constant 493624, but I didn't realize that at the time.

Notice that many of the offsets I gave you were not available in the compendium. To become a better hacker, you should strive to explore the exe and find your own special addresses.
 
Aug 10, 2011 at 6:43 PM
Professional Whatever
"Life begins and ends with Nu."
Join Date: Jan 13, 2011
Location: Lasagna
Posts: 4481
OllyDBG has a search function? That would have helped!
Thanks a bunch, carrot.
 
Aug 12, 2011 at 7:17 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Aug 12, 2011
Location: Internet wasteland (Hawaii)
Posts: 2
Few scripting problems

I did search these problems and i cant find the answer, so, yeah.

Doors: When i scripted a door so it sent me to a map i made it simply crashed the game, i think it's because i can't go to a 95th map and theres a 94 map limit?

tile and sprite sets: how do i make new ones?

misc:
is it possible to change your character image in the middle of a game?


if it helps, im using Sue's workshop for map editing and Cave editor for scripting.
 
Aug 12, 2011 at 7:26 PM
Creating A Legacy...
Bobomb says: "I need a hug!"
Join Date: Sep 6, 2009
Location: The Balcony
Posts: 852
Age: 29
Re: Few scripting problems

if it helps, im using Sue's workshop for map editing and Cave editor for scripting.
First off Sue's workshop and Cave Editor are not compatible with each other.. The exe will probably break and you wont even be able to run the game. As much as Sues is fancy and user friendly Cave editor is a lot more powerful and has some real useful tools.

Doors: When i scripted a door so it sent me to a map i made it simply crashed the game, i think it's because i can't go to a 95th map and there's a 94 map limit?

This may be something to do with Sue's. Your best bet is to Copy or Duplicate a map (Through the editor not through explorer) and then make your map from there.

misc:
is it possible to change your character image in the middle of a game?
Yep, use the Mimiga Mask for this, The sprites on the bottom of Mychar.pbm are the sprites used for this.

tile and sprite sets: how do i make new ones?
Your best bet is to just stick to the ones already used in the game and edit them.. Remember in Cave Editor to remove the (C)Pixel requirement (Go to game settings I think) so you can edit the images without crashing the game


Best of luck!
 
Aug 12, 2011 at 7:36 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Aug 12, 2011
Location: Internet wasteland (Hawaii)
Posts: 2
Re: Few scripting problems

well the thing is i need more than just one diferent character look, im trying to make it so I can change between 16 diferent characters.

(i'm making an mspa mod for cavestory :D)
(IDK if anyone even knows about mspa on this forum lol...)
 
Aug 12, 2011 at 7:41 PM
Creating A Legacy...
Bobomb says: "I need a hug!"
Join Date: Sep 6, 2009
Location: The Balcony
Posts: 852
Age: 29
Re: Few scripting problems

I hate to break your dream but you haven't got a chance of 16 characters.... (not unless you know Assembelly, I very much doubt you do)

You should juts make your game in Game maker or some shit.
 
Aug 12, 2011 at 8:32 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3054
Aw, thanks noxy.

@ ninjamaokdsnkla
I'm pretty sure you also can make new tilesets and spritesets - you just make a dot pbm and name it in the same manner as the other tilesets/spritesets (NpcXXXX PrtXXXX etc).
 
Aug 14, 2011 at 2:19 AM
Senior Member
"Huzzah!"
Join Date: Aug 10, 2011
Location:
Posts: 222
Character change?

How do you change how the characters look in sue's workshop? I'm asking this before I start it up the first time, so I might find it out on my own, but I'm wanting to make a different story with a different role for the main character, so I wanted to post this out.:sue:
 
Aug 14, 2011 at 2:29 AM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3054
Re: Character change?

Open MyChar.pbm. Draw.
In the future, post your questions in the Quick Hacking Q/A Please.
 
Aug 14, 2011 at 2:30 AM
I don't anymore.
"I'm sorry Mario, but your princess is in another castle."
Join Date: Aug 9, 2010
Location: Greener Pastures
Posts: 1190
Age: 30
Re: Character change?

:muscledoc:
linkruler said:
How do you change how the characters look in sue's workshop? I'm asking this before I start it up the first time, so I might find it out on my own, but I'm wanting to make a different story with a different role for the main character, so I wanted to post this out.:awesomeface:

You don't. Sue's Workshop can glitchy with new images unless you do something with them, which I don't remember right now. Use Cave Editor. It has a built in graphics editor.

Also this should be a question in the quick modding/hacking answers thread, and not it's own thread. I did this 4 times before realizing it.
 
Top