Mirage Engine
32x64 problem + graphic question - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: 32x64 problem + graphic question (/showthread.php?tid=1705)



32x64 problem + graphic question - Gierek - 26-04-2008

Hi
I'm Polish and my English isn't very good, sorry :oops:

1. I changed sprites size from 32x32 to 32x64 and it isn't ok. It shows sprites in a good size, but upper part of the sprite doesn't fit to the lower.
This problem exist only in few position, not everytime.
Look:
[Image: bladpf1.jpg]
Sprite of Gieroes is ok, upper and lower parts fit to each other, but Styku96's sprite's parts doesnt fit.

Any sugestions to solve it?

2. Are there any functions, commands to change image? For Example to blur it or make some other effect on it.


Thanks for any reply, and again sorry for my English;]


Re: 32x64 problem + graphic question - Gierek - 27-04-2008

Any ideas?


Re: 32x64 problem + graphic question - Kousaten - 28-04-2008

1.

Imageshack is blocked on my campus network so I can't see the image, but it could be a problem with positioning in sprites.bmp (or .png/.gif/.whatever-you-use). There could be an error in coding if it's just like... your top half is facing left and bottom is facing forward, or something. I can't say for sure since I can't see it nor your code.

2.

I haven't a clue. Sad


Re: 32x64 problem + graphic question - Robin - 28-04-2008

Make sure the animation code in BltPlayer matches that of BltPlayerTop.


Re: 32x64 problem + graphic question - Gierek - 28-04-2008

I didn't change any code in blting, only changed 32x32 to 32x64.
How can I show you this image?;p

It's Like That:

+++++
+++++

It's a sprite.
Everything + should by under +, but sometimes it's like that:
+++++
+++++

Position of upper part is another than lower.

Any ideas?Big Grin


Re: 32x64 problem + graphic question - Rian - 28-04-2008

Here, try this tutorial:
http://web.miragesource.com/forums/viewtopic.php?f=75&t=45&hilit=32x64


Re: 32x64 problem + graphic question - Gierek - 28-04-2008

Ups, I didn't say sth Big Grin
I use Elysium Diamond and I think, ekhm, Im sure that bltplayertop is there;]


Re: 32x64 problem + graphic question - Gierek - 28-04-2008

FIX:

It's Like That:

+++++
+++++

It's a sprite.
Everything + should by under +, but sometimes it's like that:
+++++
.+++++

Position of upper part is another than lower.


Re: 32x64 problem + graphic question - Gierek - 28-04-2008

Ok, I discovered sth.
This bug appears only on two frames-right walking.
It appears when char goes to right. Any ideas now?Big Grin


Re: 32x64 problem + graphic question - Stomach Pulser - 28-04-2008

Give us a picture of you sprite on the tilesheet, cause I don't see anything wrong with the sprite...


Re: 32x64 problem + graphic question - Rian - 28-04-2008

He means one straight from the sheet, so we have something to compare to find the problem


Re: 32x64 problem + graphic question - Gierek - 29-04-2008

Ok, look
[Image: spriteerrorkx9.jpg]
First line is from sprites.bmp, secound is from game. Do you see it now?


Re: 32x64 problem + graphic question - Robin - 29-04-2008

Gierek Wrote:Ok, look
[Image: spriteerrorkx9.jpg]
First line is from sprites.bmp, secound is from game. Do you see it now?

I've already told you how to solve your problem. Your animation code in BltPlayer and BltPlayerTop are mismatched.

Robin Wrote:Make sure the animation code in BltPlayer matches that of BltPlayerTop.



Re: 32x64 problem + graphic question - Robin - 30-04-2008

Actually, now I look again it might not be the animation code but the offset lines.


Re: 32x64 problem + graphic question - Rory - 30-04-2008

ED2 always had a problem with 32x64 sprites, if you mean that the top half of the player is moved a pixel to the left or right.
There was a fix on the old forum somewhere there, but its lost forever.


Re: 32x64 problem + graphic question - Gierek - 30-04-2008

Ok..

BltPlayer:
Code:
Sub BltPlayer(ByVal Index As Long)
Dim Anim As Byte
Dim x As Long, y As Long
Dim AttackSpeed As Long

    If GetPlayerWeaponSlot(Index) > 0 Then
        AttackSpeed = 1000 - (GetPlayerSPEED(Index) * 2)
    Else
        AttackSpeed = 1000
    End If

    ' Only used if ever want to switch to blt rather then bltfast
    ' I suggest you don't use, because custom sizes won't work any longer
    With rec_pos
        .Top = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (SIZE_Y - PIC_Y)
        .Bottom = .Top + PIC_Y
        .Left = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + ((SIZE_X - PIC_X) / 2)
        .Right = .Left + PIC_X + ((SIZE_X - PIC_X) / 2)
    End With
    
    ' Check for animation
    Anim = 0
    If Player(Index).Attacking = 0 Then
        Select Case GetPlayerDir(Index)
            Case DIR_UP
                If (Player(Index).YOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_DOWN
                If (Player(Index).YOffset > PIC_Y / 2 * -1) Then Anim = 1
            Case DIR_LEFT
                If (Player(Index).XOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_RIGHT
                If (Player(Index).XOffset > PIC_Y / 2 * -1) Then Anim = 1
        End Select
    Else
        If Player(Index).AttackTimer + Int(AttackSpeed / 2) > GetTickCount Then
            Anim = 2
        End If
    End If
    
    ' Check to see if we want to stop making him attack
    If Player(Index).AttackTimer + AttackSpeed < GetTickCount Then
        Player(Index).Attacking = 0
        Player(Index).AttackTimer = 0
    End If
    
    rec.Top = GetPlayerSprite(Index) * SIZE_Y + (SIZE_Y - PIC_Y)
    rec.Bottom = rec.Top + PIC_Y
    rec.Left = (GetPlayerDir(Index) * (3 * (SIZE_X / PIC_X)) + (Anim * (SIZE_X / PIC_X))) * PIC_X
    rec.Right = rec.Left + SIZE_X

    x = GetPlayerX(Index) * PIC_X - (SIZE_X - PIC_X) / 2 + sx + Player(Index).XOffset
    y = GetPlayerY(Index) * PIC_Y - (SIZE_Y - PIC_Y) + sx + Player(Index).YOffset + (SIZE_Y - PIC_Y)
    
    If SIZE_X > PIC_X Then
        If x < 0 Then
            x = Player(Index).XOffset + sx + ((SIZE_X - PIC_X) / 2)
            If GetPlayerDir(Index) = DIR_RIGHT And Player(Index).Moving > 0 Then
                rec.Left = rec.Left - Player(Index).XOffset
            Else
                rec.Left = rec.Left - Player(Index).XOffset + ((SIZE_X - PIC_X) / 2)
            End If
        End If
        
        If x > MAX_MAPX * 32 Then
            x = MAX_MAPX * 32 + sx - ((SIZE_X - PIC_X) / 2) + Player(Index).XOffset
            If GetPlayerDir(Index) = DIR_LEFT And Player(Index).Moving > 0 Then
                rec.Right = rec.Right + Player(Index).XOffset
            Else
                rec.Right = rec.Right + Player(Index).XOffset - ((SIZE_X - PIC_X) / 2)
            End If
        End If
    End If
    
    Call DD_BackBuffer.BltFast(x - (NewPlayerX * PIC_X) - NewXOffset, y - (NewPlayerY * PIC_Y) - NewYOffset, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Sub

BltPlayerTop:
Code:
Sub BltPlayerTop(ByVal Index As Long)
Dim Anim As Byte
Dim x As Long, y As Long
Dim AttackSpeed As Long

    If GetPlayerWeaponSlot(Index) > 0 Then
        AttackSpeed = item(GetPlayerInvItemNum(Index, GetPlayerWeaponSlot(Index))).AttackSpeed
    Else
        AttackSpeed = 1000
    End If

    ' Only used if ever want to switch to blt rather then bltfast
    ' I suggest you don't use, because custom sizes won't work any longer
    With rec_pos
        .Top = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (SIZE_Y - PIC_Y)
        .Bottom = .Top + PIC_Y
        .Left = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + ((SIZE_X - PIC_X) / 2)
        .Right = .Left + PIC_X + ((SIZE_X - PIC_X) / 2)
    End With
    
    ' Check for animation
    Anim = 0
    If Player(Index).Attacking = 0 Then
        Select Case GetPlayerDir(Index)
            Case DIR_UP
                If (Player(Index).YOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_DOWN
                If (Player(Index).YOffset < PIC_Y / 2 * -1) Then Anim = 1
            Case DIR_LEFT
                If (Player(Index).XOffset < PIC_Y / 2) Then Anim = 1
            Case DIR_RIGHT
                If (Player(Index).XOffset < PIC_Y / 2 * -1) Then Anim = 1
        End Select
    Else
        If Player(Index).AttackTimer + Int(AttackSpeed / 2) > GetTickCount Then
            Anim = 2
        End If
    End If
    
    ' Check to see if we want to stop making him attack
    If Player(Index).AttackTimer + AttackSpeed < GetTickCount Then
        Player(Index).Attacking = 0
        Player(Index).AttackTimer = 0
    End If
    
    rec.Top = GetPlayerSprite(Index) * SIZE_Y
    rec.Bottom = rec.Top + (SIZE_Y - PIC_Y)
    rec.Left = (GetPlayerDir(Index) * (3 * (SIZE_X / PIC_X)) + (Anim * (SIZE_X / PIC_X))) * PIC_X
    rec.Right = rec.Left + SIZE_X

    x = GetPlayerX(Index) * PIC_X - (SIZE_X - PIC_X) / 2 + sx + Player(Index).XOffset
    y = GetPlayerY(Index) * PIC_Y - (SIZE_Y - PIC_Y) + sx + Player(Index).YOffset
    
    
    If y < 0 Then
        y = 0
        If GetPlayerDir(Index) = DIR_DOWN And Player(Index).Moving > 0 Then
            rec.Top = rec.Top - Player(Index).YOffset
        Else
            rec.Top = rec.Top - Player(Index).YOffset + (SIZE_Y - PIC_Y)
        End If
    End If
    
    If SIZE_X > PIC_X Then
        If x < 0 Then
            x = Player(Index).XOffset + sx + ((SIZE_X - PIC_X) / 2)
            If GetPlayerDir(Index) = DIR_RIGHT And Player(Index).Moving > 0 Then
                rec.Left = rec.Left - Player(Index).XOffset
            Else
                rec.Left = rec.Left - Player(Index).XOffset + ((SIZE_X - PIC_X) / 2)
            End If
        End If
        
        If x > MAX_MAPX * 32 Then
            x = MAX_MAPX * 32 + sx - ((SIZE_X - PIC_X) / 2) + Player(Index).XOffset
            If GetPlayerDir(Index) = DIR_LEFT And Player(Index).Moving > 0 Then
                rec.Right = rec.Right + Player(Index).XOffset
            Else
                rec.Right = rec.Right + Player(Index).XOffset - ((SIZE_X - PIC_X) / 2)
            End If
        End If
    End If
    
    Call DD_BackBuffer.BltFast(x - (NewPlayerX * PIC_X) - NewXOffset, y - (NewPlayerY * PIC_Y) - NewYOffset, DD_SpriteSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
End Sub



Re: 32x64 problem + graphic question - Robin - 30-04-2008

What source do you use?


Re: 32x64 problem + graphic question - Gierek - 01-05-2008

Elysium Diamond 2.0


Re: 32x64 problem + graphic question - Robin - 01-05-2008

Right, I suggest you tell us that before hand as this is a Mirage forum, so we assume that you're using Mirage Source.


Re: 32x64 problem + graphic question - Rory - 01-05-2008

Gierek Wrote:Ups, I didn't say sth Big Grin
I use Elysium Diamond and I think, ekhm, Im sure that bltplayertop is there;]

Eh.. Robin


Re: 32x64 problem + graphic question - Robin - 01-05-2008

He posted that after me. Big Grin


Re: 32x64 problem + graphic question - Tony - 13-05-2008

I don't know the fix but I really like the sprites

:p


Re: 32x64 problem + graphic question - Robin - 13-05-2008

There's no need to post then.


Re: 32x64 problem + graphic question - Tony - 15-05-2008

Robin Wrote:There's no need to post then.

No need to be so anal towards the people you dislike/hate

but since your.. administrator I'll be the small one here and

just back off.


Re: 32x64 problem + graphic question - Robin - 15-05-2008

I don't hate you >_>