Mirage Source
http://web.miragesource.net/forums/

32*64 NPC's Full Tut
http://web.miragesource.net/forums/viewtopic.php?f=210&t=635
Page 1 of 2

Author:  DarkX [ Sat Oct 14, 2006 5:21 pm ]
Post subject:  32*64 NPC's Full Tut

Tutorial by: DarkX
Code tested on: MSE

Ok I was looking over all the things that were missing on that version that William posted, which I guess was made by Sign, not really sure, but I wanted people to have the whole idea before they add it, here's my version of the tutorial.

Ok this is all client side, let's start with this:
Code:
        ' Blit out the npcs
        For i = 1 To MAX_MAP_NPCS
             Call BltNpc(i)
        Next i

It should be duplicated, (copy it and paste it right beneath the first one)
It should look like this:
Code:
        ' Blit out the npcs top
        For i = 1 To MAX_MAP_NPCS
             Call BltNpcTop(i)
        Next i

Next we should move along to find " Public sub BltNPC(Byvl MapNpcNum as long) "
copy the entire sub. Then paste it below the first one and rename it, " Public sub BltNpcTop(byval MapNpcNum as long) "

In bltNpcTop; replace This:
Code:
    ' Check if its out of bounds because of the offset
    If y < 0 Then
        y = 0
        With rec
             .top = .top + (y * -1)
        End With
    End If

With this:
Code:
    ' Check if its out of bounds because of the offset
    y = y - 32
    If y < 0 And y > -32 Then
        With rec
              .top = .top - y
              y = 0
        End With
    End If

Tim to move along; let's work on the rest go into sub BltNpc; and replace This:
Code:
    With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With

With This:
Code:
    With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y + PIC_Y
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With

Keep it moving theres more to see, go into BltNpcTop and replace This
Code:
    With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With

With this:
Code:
    With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y * 2
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With


Now that's still not all of it.
Go into sub BltMapNpcName and replace This:
Code:
TextY = MapNpc(Index).y * PIC_Y + MapNpc(Index).YOffset - CLng(PIC_Y / 2) - 4

With this:
Code:
TextY = MapNpc(Index).Y * PIC_Y + MapNpc(Index).YOffset - 50 '(or-4 -  pic_y - pic_y/2)

Again Still not all of it; there's a little more be patient. Ok go into frmNpcEditor and click picSprite
Make it's width 480
And it's height 960
And finally the LAST part.
In modGameLogic find Sub NPCEditorBltSprite
Once you've found it, replace the whole sub with this:
Code:
Public Sub NpcEditorBltSprite()
    Call BitBlt(frmNpcEditor.picSprite.hdc, 0, 0, PIC_X, PIC_Y * 2, frmNpcEditor.picSprites.hdc, 3 * PIC_X, frmNpcEditor.scrlSprite.Value * PIC_Y * 2, SRCCOPY)
End Sub


Or just put this: *2 :After every PIC_Y.

And that's the complete tutorial; have fun with it.

Author:  one [ Sun Nov 05, 2006 3:36 pm ]
Post subject: 

nice, but the npc top is sill under the playersprite :(

Author:  Shadow Dragon [ Sun Nov 05, 2006 3:37 pm ]
Post subject: 

Yeah, I'm not sure how to fix that, I've been working on this fixing it since he posted the tut

Author:  DarkX [ Sun Nov 05, 2006 3:42 pm ]
Post subject: 

I was looking over my code and it blt's correctly for me, it blts the players head over the npc's... Though I have to work on the part where it blts your feet over the npc's head.

Author:  Forte [ Sun Dec 03, 2006 6:25 am ]
Post subject: 

Sorry for bringing back this old tut guys,but im Quake. Im new to VB and Mirage. I was testing out this tutorial and i thought i could help DarkX a bit. I hope you dont get offended if you think im trying to make my way look better im only trying to help :D

Well, I placed
Code:
        ' Blit out the npcs top
        For i = 1 To MAX_MAP_NPCS
             Call BltNpcTop(i)
        Next i


AFTER
Code:
    ' Blit out players
        For i = 1 To MAX_PLAYERS
              If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                  Call BltPlayer(i)
              End If
        Next i


By doing this, it makes the NPC tops over the players.

Now for some reason this bit of code didnt work well for me
Code:
 With rec
        .top = Npc(MapNpc(MapNpcNum).Num).Sprite * PIC_Y * 2
        .Bottom = .top + PIC_Y
        .Left = (MapNpc(MapNpcNum).Dir * 3 + Anim) * PIC_X
        .Right = .Left + PIC_X
    End With


So i just removed the * 2 after PIC_Y and it worked. I dont actually know what i did lol but it works. BTW nice tut i used it

Author:  Rezeyu [ Mon Apr 16, 2007 12:06 am ]
Post subject: 

Not sure if I was the only one that got this error, but my NPc's kept showing up like this if the sprite number was odd:

Image

So I simply went into Sub NPCEditorOk() and changed this line:

Code:
Npc(EditorIndex).Sprite = frmNpcEditor.scrlSprite.Value * 2


And in Sub NPCEditorInit()

Code:
frmNpcEditor.scrlSprite.Value = Npc(EditorIndex).Sprite / 2


(At first I thought I need to double the editor's scroll value, but that wasn't the case.)

Author:  Tony [ Mon Apr 16, 2007 7:36 am ]
Post subject: 

What font is that? And you better tell meh!

Author:  Matt [ Mon Apr 16, 2007 1:26 pm ]
Post subject: 

Looks like Arial.

Author:  Rezeyu [ Mon Apr 16, 2007 7:18 pm ]
Post subject: 

Tahomaz0rz

Author:  Tony [ Tue Apr 17, 2007 3:06 am ]
Post subject: 

Rezeyu wrote:
Tahomaz0rz


Whats the exacts?! Tahoma Bold, size?

Author:  Rezeyu [ Tue Apr 17, 2007 3:10 am ]
Post subject: 

Code:
' Font variables
Public Const FONT_NAME = "tahoma"
Public Const FONT_SIZE = 18


No other variables changed. Except stroked.

Author:  Tony [ Tue Apr 17, 2007 3:11 am ]
Post subject: 

Why the hell is your shit so smooth?

Author:  Rezeyu [ Tue Apr 17, 2007 3:14 am ]
Post subject: 

Umm.. I dunno.

When I added the stroked text, I sued Elysium's tut because I couldn't find the one I used from Mirage on my original source.

(I think it was lost from the backups)


Then I went into a tut request about text outline and I think I actually used YOUR modification to the code..

Code:
    Call TextOut(hdc, x + 1, y + 0, Text, Len(Text))
    Call TextOut(hdc, x + 0, y + 1, Text, Len(Text))
    Call TextOut(hdc, x + 1, y + 1, Text, Len(Text))
    Call TextOut(hdc, x - 1, y - 0, Text, Len(Text))
    Call TextOut(hdc, x - 0, y - 1, Text, Len(Text))
    Call TextOut(hdc, x - 1, y - 1, Text, Len(Text))

Author:  Tony [ Tue Apr 17, 2007 3:19 am ]
Post subject: 

I'm positive thats not it o.o

I guess its gfx card concerns?

Author:  Rezeyu [ Tue Apr 17, 2007 4:11 am ]
Post subject: 

Mehbeh..

I'm running on a 256MB ATI Radeon X1300 Pro, I needed a 256g= Meg card to run Vista.


<Has Home Premium, and Aero was demanding>

Author:  Boo [ Tue Apr 17, 2007 9:51 pm ]
Post subject: 

Try chaning your resolution to like 16 Bit, see if that helps :o

Author:  El_Dindonnier [ Sun Dec 16, 2007 10:45 am ]
Post subject:  Re: 32*64 NPC's Full Tut

Hello, i have a bug, look that :
Image

Can I help me please ?

Thanks you in advance.

Author:  Lea [ Sun Dec 16, 2007 3:13 pm ]
Post subject:  Re: 32*64 NPC's Full Tut

If you loop from the top left of the map to the bottom right, the back sprite will show below the front

Author:  Ramsey [ Tue Feb 19, 2008 1:56 pm ]
Post subject:  Re: 32*64 NPC's Full Tut

Sorry for necroing but I just had to put up the bug fix.

Refer to: Image

This can easily be fixed by moving the:
Code:
        ' Blit out the npcs top
        For i = 1 To MAX_MAP_NPCS
            Call BltNpcTop(i)
        Next i



Under:
Code:
        ' Blit out players
        For i = 1 To MAX_PLAYERS
            If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                Call BltPlayer(i)
            End If
        Next i



Making it look like:
Code:
        ' Blit out the npcs
        For i = 1 To MAX_MAP_NPCS
            Call BltNpc(i)
        Next i
       
        ' Blit out players
        For i = 1 To MAX_PLAYERS
            If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                Call BltPlayer(i)
            End If
        Next i
       
        ' Blit out the npcs top
        For i = 1 To MAX_MAP_NPCS
            Call BltNpcTop(i)
        Next i
       
        ' Blit out players top
        For i = 1 To MAX_PLAYERS
              If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                  Call BltPlayerTop(i)
              End If
        Next i


Solved.

Author:  Rhyfelwr [ Thu Jul 24, 2008 6:01 am ]
Post subject:  Re: 32*64 NPC's Full Tut

That bug fix doesn't work for me.. I tried this out and I still get the doubled sprite.. Instead of getting the "top" sprite?

Author:  DarkX [ Thu Jul 24, 2008 9:40 pm ]
Post subject:  Re: 32*64 NPC's Full Tut

somewhere up above one of the guys posted a fix replace the * with a /

Author:  Robin [ Mon Aug 11, 2008 2:31 pm ]
Post subject:  Re: 32*64 NPC's Full Tut

Why do you need an algorithm?

Code:
For y = 0 to max_mapy
For i = 1 to HighIndex
If getplayery(i) = y then
bltplayer
end if
next
next


Something like that should work.

Author:  wanai [ Tue Nov 02, 2021 7:50 am ]
Post subject:  Re: 32*64 NPC's Full Tut

Econ203.5BettDEFIPropSideSidnDreaVisiFyodAlfrToccDekoStriTendPaveTescRondMajeWindBlayXVIIroad
IoseMartVeroHowaWindKeraTeanAllaWateWillGeorRambWestSupeSpecBaroRodnTAXIBradJeanHaveBabbWell
GrimCityTranSansBichLineWindTroyQWERNokishinRossFutuJackPetePrakXIIILakaClowXVIIXIIIMarkEreb
SapoMonsJameEmmaApolDuetClicHenrIvanFrohWrigMicrEdwaZoneSwarJameFOTOFamiMiyoZoneCallBIOSRusi
DomiEricLapiBobbZoneZoneCantAlbeZoneWiFiZoneZoneZonediamZoneChetXVIIEdgaZoneSonyHampXVIIJame
ZoneXVIIBradPoweSpecKronVestCataBookMagnHangTimoCharESACChicWingMistBeflMystDennHechMedlIris
EvreEducEducMariBatuBoomRollDeicWindWindCrayValeChouCafeWhisHarrLizaSantwwwmSofiAgatRobeTick
actiPampRobeXVIIVIIIErneEsaiGiusInclMemoPeteThisBogdTillXVIIJammViktRussGoldInteMoveProlWinx
ThisTaxaMichWilsJerePianLangwwwrMIRANineChosJeweReadRobeBuilVariDawnIncrDigiLynyMariPowePowe
PoweBIOSSugaNeveChriSpliRennWillPartMusiMariWillRajetuchkasJamePubb

Author:  wanai [ Fri Feb 18, 2022 1:10 am ]
Post subject:  Re: 32*64 NPC's Full Tut

Econ191.5BettLaboRadiCaliWillDennCepeGeorAndrXVIITaenSympXVIIchrysimpDormZyliGoodVIIITerrJack
SonaTimoTescLiebWindSupeGezaContShauXVIIAndrDeepIntrBylyJeweEdouJennAkseJaneWindDownStevLabo
BarrAnurSimsCedrSorrWongSimsMercopusChrimiliAndrBarbDaviDolbAnthVictArbeOetkSallAdioGaudRowb
RamaPushRajnSalvJeffRichSelaThomBrenBramGeorDrWeLobsZoneFuxiGreeWhatZyciZoneZoneCuddJohnFuxi
diamMornArtsGorgZoneZoneWaylRobeZoneAudiZoneZoneZoneZoneZoneJohnHeinZoneZoneTranXVIIOtakLock
ZoneXXIIBronHarmMeriKronVestCataBookLambSnooPhilPostPolazhenMBXXMistSQuiKenwLionRigaBritTang
RocoHappEducexclAliaLoveWarhWindJeweWindSilwRedmChouEscaWhisArthJackNASAWindKosmSileHumpXVII
wwwcNapoXVIITituHolgSinfPhylTheoNegrCharBenoTimeCoeuWorlBetwJeffPhilCOBRDonaInteJaniGateBrat
PetrsupeXVIIMichMediReadBookEthePaulTimeMillLIVEKoldAmazMarcRedeEmerWindJennChirWillHarmHarm
HarmGeieLikePhilBonnTellwwwnBookKaurJasmNeueValeScottuchkasBonnAstr

Author:  wanai [ Tue Mar 15, 2022 8:43 pm ]
Post subject:  Re: 32*64 NPC's Full Tut

инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоmagnetotelluricfield.ruинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоtuchkasинфоинфо

Page 1 of 2 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/