Mirage Source
Remove the need for BltPlayerTop - Printable Version

+- Mirage Source (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: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: Remove the need for BltPlayerTop (/showthread.php?tid=2047)



Remove the need for BltPlayerTop - Robin - 30-08-2008

Code:
For y = 0 To MAX_MAPY
    ' Blit out the npcs
    For i = 1 To MAX_MAP_NPCS
        If MapNpc(i).y = y Then
            Call BltNpc(i)
        End If
    Next i
                    
    ' Blit out players
    For i = 1 To MAX_PLAYERS
        If IsPlaying(i) Then
            If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                If GetPlayerY(i) = y Then
                    Call BltPlayer(i)
                End If
            End If
        End If
    Next i
Next y



Re: Remove the need for BltPlayerTop - JokeofWeek - 30-08-2008

Aha, such a quick fix, good optimization too, since it saves you the extra MAX_PLAYERS loop Big Grin You can do this with BltNPCtop also, but you can't have both fixes, coz what if, for example, the NPC's top had to go over the player's bottom. All in all, a good optimization though Big Grin Saves at least one big loop Smile Nice one Robin :wink:


Re: Remove the need for BltPlayerTop - Robin - 30-08-2008

It already handles the NPC as well. Look at the code xD

I've been meaning to do something like this for ages. I originally had it as:

For y = max_mapy to 0 step - 1

Thinking that it should render from bottom to top. Silly mistake tbh xD


Re: Remove the need for BltPlayerTop - JokeofWeek - 30-08-2008

Robin Wrote:It already handles the NPC as well. Look at the code xD

I've been meaning to do something like this for ages. I originally had it as:

For y = max_mapy to 0 step - 1

Thinking that it should render from bottom to top. Silly mistake tbh xD

:O True xD Hadn't realized that Tongue Although, it's probably the easiest to do in DX8, just set the Z value I'd beleive xD Nice optimization for DX7 though Smile


Re: Remove the need for BltPlayerTop - Robin - 31-08-2008

I use the same method in Dx8.