Mirage Source

Free ORPG making software.
It is currently Thu Apr 25, 2024 4:17 am

All times are UTC




Post new topic Reply to topic  [ 56 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Weather System
PostPosted: Fri Mar 09, 2007 10:39 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Always wanted weather for your game?

Always thought you could do it yourself?

Tried the weather from the old forms and aren't happy with it's results?

You've come to the right place! This is from Konfuze's source, or whatever they wanna call it now..(Elysium... Diamond..?) Anyways...

Don't add this unless you've saved your code.

Level of Dificulty: 1/5(Just C&P and Understand...)

First, and foremost, back up your code.

Second, Open the Server.

This is the only thing you have to add.

Change
Code:
' Lets change the weather if its time to
    If WeatherSeconds >= 60 Then
        i = Int(Rnd * 3)
        If i <> GameWeather Then
            GameWeather = i
            Call SendWeatherToAll
        End If
        WeatherSeconds = 0
    End If


To read

Code:
' Lets change the weather if its time to
    If WeatherSeconds >= 18600 / 2 Then
        i = Int(Rnd * 3)
        If i <> GameWeather Then
            GameWeather = i
            Call SendWeatherToAll
            Call PutVar(FileName, "Weather", "Weather", Trim(GameWeather))
        End If
        WeatherSeconds = 0
    End If


That just checks for half a day(12 hours, irl) and changes the weather randomly.

Also, uncomment this line
Code:
WeatherSeconds = WeatherSeconds + 1


That's important. Keeps the time for weather.

Now, close the server. You're done with it. (AHMAGAWD, THAT WAS EASY!!1)

Next, open the client. Open modDirectX.

Put this in there
Code:
Sub BltWeather()
Dim i As Long

    Call DD_BackBuffer.SetForeColor(RGB(0, 0, 200))
   
    If GameWeather = WEATHER_RAINING Then
        For i = 1 To MAX_RAINDROPS
            If DropRain(i).Randomized = False Then
                If frmMirage.tmrRainDrop.Enabled = False Then
                    BLT_RAIN_DROPS = 1
                    frmMirage.tmrRainDrop.Enabled = True
                    If frmMirage.tmrRainDrop.Tag = "" Then
                        frmMirage.tmrRainDrop.Interval = 200
                        frmMirage.tmrRainDrop.Tag = "123"
                    End If
                End If
            End If
        Next i
    ElseIf GameWeather = WEATHER_SNOWING Then
        For i = 1 To MAX_RAINDROPS
            If DropSnow(i).Randomized = False Then
                If frmMirage.tmrSnowDrop.Enabled = False Then
                    BLT_SNOW_DROPS = 1
                    frmMirage.tmrSnowDrop.Enabled = True
                    If frmMirage.tmrSnowDrop.Tag = "" Then
                        frmMirage.tmrSnowDrop.Interval = 200
                        frmMirage.tmrSnowDrop.Tag = "123"
                    End If
                End If
            End If
        Next i
    Else
        If BLT_RAIN_DROPS > 0 And BLT_RAIN_DROPS <= RainIntensity Then
            Call ClearRainDrop(BLT_RAIN_DROPS)
        End If
        frmMirage.tmrRainDrop.Tag = ""
    End If
   
    'actually blt the rain
    For i = 1 To MAX_RAINDROPS
        If Not ((DropRain(i).X = 0) Or (DropRain(i).Y = 0)) Then
            DropRain(i).X = DropRain(i).X + DropRain(i).Speed
            DropRain(i).Y = DropRain(i).Y + DropRain(i).Speed
            Call DD_BackBuffer.DrawLine(DropRain(i).X, DropRain(i).Y, DropRain(i).X + DropRain(i).Speed, DropRain(i).Y + DropRain(i).Speed)
            If (DropRain(i).X > (MAX_MAPX + 1) * PIC_X) Or (DropRain(i).Y > (MAX_MAPY + 1) * PIC_Y) Then
                DropRain(i).Randomized = False
            End If
        End If
    Next i
       
        'declare snow tile
        rec.top = 0
        rec.Bottom = rec.top + PIC_Y
        rec.Left = 0
        rec.Right = rec.Left + PIC_X
       
        'actualy blt the snow
        For i = 1 To MAX_RAINDROPS
            If Not ((DropSnow(i).X = 0) Or (DropSnow(i).Y = 0)) Then
                DropSnow(i).X = DropSnow(i).X + DropSnow(i).Speed
                DropSnow(i).Y = DropSnow(i).Y + DropSnow(i).Speed
                Call DD_BackBuffer.BltFast(DropSnow(i).X + DropSnow(i).Speed, DropSnow(i).Y + DropSnow(i).Speed, DD_SnowSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
                If (DropSnow(i).X > (MAX_MAPX + 1) * PIC_X) Or (DropSnow(i).Y > (MAX_MAPY + 1) * PIC_Y) Then
                    DropSnow(i).Randomized = False
                End If
            End If
        Next i
       
    ' If it's raining, make the screen randomly flash white
    If GameWeather = WEATHER_RAINING Then
        If Int((100 - 1 + 1) * Rnd) + 1 = 8 Then
            DD_BackBuffer.SetFillColor RGB(255, 255, 255)
            Call DD_BackBuffer.DrawBox(0, 0, (MAX_MAPX + 1) * PIC_X, (MAX_MAPY + 1) * PIC_Y)
        End If
    End If
End Sub

Sub ClearRainDrop(ByVal RDNumber As Long)
On Error Resume Next
    DropRain(RDNumber).X = 0
    DropRain(RDNumber).Y = 0
    DropRain(RDNumber).Speed = 0
    DropRain(RDNumber).Randomized = False
End Sub

Sub ClearSnowDrop(ByVal RDNumber As Long)
On Error Resume Next
    DropSnow(RDNumber).X = 0
    DropSnow(RDNumber).Y = 0
    DropSnow(RDNumber).Speed = 0
    DropSnow(RDNumber).Randomized = False
End Sub

Sub RNDRainDrop(ByVal RDNumber As Long)
Start:
    DropRain(RDNumber).X = Int((((MAX_MAPX + 1) * PIC_X) * Rnd) + 1)
    DropRain(RDNumber).Y = Int((((MAX_MAPY + 1) * PIC_Y) * Rnd) + 1)
    If (DropRain(RDNumber).Y > (MAX_MAPY + 1) * PIC_Y / 4) And (DropRain(RDNumber).X > (MAX_MAPX + 1) * PIC_X / 4) Then GoTo Start
    DropRain(RDNumber).Speed = Int((10 * Rnd) + 6)
    DropRain(RDNumber).Randomized = True
End Sub

Sub RNDSnowDrop(ByVal RDNumber As Long)
Start:
    DropSnow(RDNumber).X = Int((((MAX_MAPX + 1) * PIC_X) * Rnd) + 1)
    DropSnow(RDNumber).Y = Int((((MAX_MAPY + 1) * PIC_Y) * Rnd) + 1)
    If (DropSnow(RDNumber).Y > (MAX_MAPY + 1) * PIC_Y / 4) And (DropSnow(RDNumber).X > (MAX_MAPX + 1) * PIC_X / 4) Then GoTo Start
    DropSnow(RDNumber).Speed = Int((10 * Rnd) + 6)
    DropSnow(RDNumber).Randomized = True
End Sub


That just blts the weather, plain and simple. If it's raining, it draws random lines. If it's snowing, it gets snow from a file(this one! Snow GFX) and blits it randomly on the screen. Also, if it's raining, It makes it go boom. xD

Now, you have the snow tile. HOW TEH HELLZ R WE GONNA PUT IT ON TEH GAME, LOL!

Simple. Just in the General Declaration part, put this
Code:
Public DD_SnowSurf As DirectDrawSurface7


Si, tis all you need. Now, go to InitSurfaces...

I'm not sure how the blank mirage does it... But, we're not noobs... Load the picture you downloaded onto the surface you declared.

If you have trouble with this, feel free to leave me a PM or IM me on a messenger.

Anyways, onwards!

Client side, put this in the declaration section of modTypes
Code:
Public MAX_RAINDROPS As Long
Public BLT_RAIN_DROPS As Long
Public DropRain() As DropRainRec
Public BLT_SNOW_DROPS As Long
Public DropSnow() As DropRainRec
Public RainIntensity As Byte


Also add this to the 'TypeRec' Area up there(anywhere before it is declared)

Code:
Type DropRainRec
    x As Long
    y As Long
    Randomized As Boolean
    Speed As Byte
End Type


One last thing to change. Then we gotta do a bit of programming for ourselves.

Find
Code:
If Lcase(Parse(0)) = "weather" Then

In handle data or something similar and replace that whole statement with this:

Code:
If (LCase(Parse(0)) = "weather") Then
        If Val(Parse(1)) = WEATHER_RAINING And GameWeather <> WEATHER_RAINING Then
            Call AddText("You see drops of rain falling from the sky above!", frmMirage.txtChat, BrightGreen)
        End If
        If Val(Parse(1)) = WEATHER_SNOWING And GameWeather <> WEATHER_SNOWING Then
            Call AddText("You see snow falling from the sky above!", frmMirage.txtChat, BrightGreen)
        End If
       
        If Val(Parse(1)) = WEATHER_NONE Then
            If GameWeather = WEATHER_RAINING Then
                Call AddText("The rain beings to calm.", frmMirage.txtChat, BrightGreen)
            ElseIf GameWeather = WEATHER_SNOWING Then
                Call AddText("The snow is melting away.", frmMirage.txtChat, BrightGreen)
            End If
        End If
        GameWeather = Val(Parse(1))
        RainIntensity = 100
        If MAX_RAINDROPS <> RainIntensity Then
            MAX_RAINDROPS = RainIntensity
            ReDim DropRain(1 To MAX_RAINDROPS) As DropRainRec
            ReDim DropSnow(1 To MAX_RAINDROPS) As DropRainRec
        End If
    End If


One more thing to do.

In Sub GameLoop Add

Code:
If InEditor = False Then
    If GameWeather <> WEATHER_NONE Then
        Call BltWeather
    End If
End If


Right under

Code:
' Blit out tile layer fringe
        For Y = 0 To MAX_MAPY
            For X = 0 To MAX_MAPX
                Call BltFringeTile(X, Y)
            Next X
        Next Y


Now, weather's almost done! Open frmMirage, and make Two Timers and set them to these values.

Timer1
Name: tmrRainDrop
Enabled: False
Interval: 100

Timer2
Name: tmrSnowDrop
Enabled: False
Interval: 100

For the timers, this is the code you want for them. Do not double click the timers to open the code window. Just right click on the form and click on 'View Code'

Add these to the bottom
Code:
Private Sub tmrRainDrop_Timer()
If BLT_RAIN_DROPS > RainIntensity Then
    tmrRainDrop.Enabled = False
    Exit Sub
End If
If BLT_RAIN_DROPS > 0 Then
        If DropRain(BLT_RAIN_DROPS).Randomized = False Then
            Call RNDRainDrop(BLT_RAIN_DROPS)
        End If
    End If
    BLT_RAIN_DROPS = BLT_RAIN_DROPS + 1
    If tmrRainDrop.Interval > 30 Then
        tmrRainDrop.Interval = tmrRainDrop.Interval - 10
    End If
End Sub

Private Sub tmrSnowDrop_Timer()
If BLT_SNOW_DROPS > RainIntensity Then
    tmrSnowDrop.Enabled = False
    Exit Sub
End If
If BLT_SNOW_DROPS > 0 Then
        If DropSnow(BLT_SNOW_DROPS).Randomized = False Then
            Call RNDSnowDrop(BLT_SNOW_DROPS)
        End If
    End If
    BLT_SNOW_DROPS = BLT_SNOW_DROPS + 1
    If tmrSnowDrop.Interval > 30 Then
        tmrSnowDrop.Interval = tmrSnowDrop.Interval - 10
    End If
End Sub


And that should be it. If you have any problems whatsoever, or if I'm missing anything, please tell me. This is as easy as I could get it, ripped from Elysium to work for MSE.

Sorry I can't explain what any of it does. I don't understand DirectX too well to do so. Maybe someone else could explain?

_________________
Image
みんな、見ていてくれ!


Last edited by Matt2 on Mon Mar 12, 2007 11:47 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 10:48 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Aug 17, 2006 5:27 pm
Posts: 866
Location: United Kingdom
Err, i may be wrong but is there not a weather editing interface missing?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 10:49 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Nah. If they want more weather, they can build off this one.

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2007 12:53 am 
Offline
Regular
User avatar

Joined: Mon May 29, 2006 7:01 pm
Posts: 45
Location: Canada, BC
Isn't this DragoonsMaster's weather system which he released ages ago on the old forums.

_________________
http://www.MMOReqs.com
http://www.ImageCookie.com
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2007 3:32 am 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
No idea.

Came from Konfuze. xD

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2007 4:39 am 
Offline
Regular
User avatar

Joined: Tue Jul 04, 2006 5:50 am
Posts: 98
In that case, yes, the rain it was based off of DragoonsMaster's code a while back =P He just had rain and I added other shit... But yeah, credit goes to him ;)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2007 6:34 am 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
Also if you add the weather command from Konfuze, don't forget to fix the security hole :P


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2007 10:37 am 
Offline
Newbie

Joined: Sun Jun 18, 2006 4:10 pm
Posts: 21
You forgot to include the DropRainRec...

Code:
Type DropRainRec
    x As Long
    y As Long
    Randomized As Boolean
    Speed As Byte
End Type


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2007 11:48 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Erik wrote:
You forgot to include the DropRainRec...

Code:
Type DropRainRec
    x As Long
    y As Long
    Randomized As Boolean
    Speed As Byte
End Type


Thank you.

I edited and updated the tutorial. Heheh, nice catch.

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 2:20 am 
Offline
Regular
User avatar

Joined: Tue Jul 04, 2006 5:50 am
Posts: 98
GameBoy wrote:
Also if you add the weather command from Konfuze, don't forget to fix the security hole :P

lol yeah xD It's not really that bad though.... ><


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 1:16 pm 
Offline
Knowledgeable
User avatar

Joined: Tue Feb 06, 2007 9:50 pm
Posts: 180
Location: Bergenfield, New Jersey, US
what the security hole? never hear about it

would'nt this make a weather on every map even in a house?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 2:44 pm 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
You can extend this easily. Add a new type to maps (indoor), if the map is indoor don't use weather. I think this was in Deloria Source.

The weather security hole was quite easy to fix. If you check the packet handler on the server you'll notice it doesn't properly check to see if a moderator is changing the weather, there's only a check on the client to see if a moderator has entered the command which means with a simple packet editor, anybody can change the weather. So make sure you do server checks as well as client checks. Very important


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 14, 2007 12:39 am 
Offline
Newbie

Joined: Tue Jun 20, 2006 12:33 pm
Posts: 14
What I dont like is how you are using a timer for the raindrop/snow drop.

Use a function like GetTickCount

Code:
Public Declare Function GetTickCount lib "Kernel32" as long()


Code:
Global SnowDropTimer1 as long  'Our Tick based timer
Global Constant SnowDropTimer2 = 100 'Our constant time in MS
Global IsRaining as boolean 'Is it raining?



Put it somewhere
Code:
SnowDropTimer1 = GetTickCount + SnowDropTimer2


Code:
If GetTickCount => SnowDropTimer1 Then
 SnowDropTimer1 = GetTickcount + SnowDropTimer2       'You've got to update the information
   Call IIf(IsRaining, IsRaining = False, IsRaining = True) 'If it is raining, then it isnt. If it isnt, then it is. :)
End If


...Use the rest for your imagination :P
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 15, 2007 12:41 am 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Not my code. xD

This is just a straigt rip. :P

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 15, 2007 4:52 am 
Offline
Newbie

Joined: Tue Jun 20, 2006 12:33 pm
Posts: 14
Ooohhh ok. Anwyays timers arent that good to use, because they work on depending the computer speed not by..pure seconds. Dont want to cause any seizures now do we? :P


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2007 1:55 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
Lol, yeah, that's mine xD
I'm not reading forums that frequently now... I just got into college and I don't have my computer here ><
Omg , that's OLD xD
Good luck with it. I still use it on my game and it works pretty good.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 2:20 pm 
Offline
Newbie

Joined: Mon Apr 16, 2007 3:55 pm
Posts: 1
Variable not Defined :( Call PutVar(FileName, "Weather", "Weather", Trim(GameWeather))


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 8:58 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
Hmm... That's a strange error. I wonder if you forgot to define "filename" somewhere.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 9:38 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
Slevin, make sure that u have Function FileName and/or it defined in modTypes. (look at another blank source and compare/contrast)

----------

EDIT: Lmao when i just tried to add this i get samething rofl!


------------

EDIT AGAIN:
Add this:
Code:
Dim FileName As String


Under:
Code:
Dim DidWalk As Boolean


Which is in the Sub GameAI()


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 11:32 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
In the Weather Packet, im having an error on AddText

Says: Wrong number of arguments or invalid property assignment.

Any idea?

Heres my whole packet:

Code:
    ' ::::::::::::::::::::
    ' :: Weather packet ::
    ' ::::::::::::::::::::
    If (LCase(Parse(0)) = "weather") Then
        If Val(Parse(1)) = WEATHER_RAINING And GameWeather <> WEATHER_RAINING Then
            Call AddText("You see drops of rain falling from the sky above!", frmMirage.txtChat, BrightGreen)
        End If
        If Val(Parse(1)) = WEATHER_SNOWING And GameWeather <> WEATHER_SNOWING Then
            Call AddText("You see snow falling from the sky above!", frmMirage.txtChat, BrightGreen)
        End If
       
        If Val(Parse(1)) = WEATHER_NONE Then
            If GameWeather = WEATHER_RAINING Then
                Call AddText("The rain beings to calm.", frmMirage.txtChat, BrightGreen)
            ElseIf GameWeather = WEATHER_SNOWING Then
                Call AddText("The snow is melting away.", frmMirage.txtChat, BrightGreen)
            End If
        End If
        GameWeather = Val(Parse(1))
        RainIntensity = 100
        If MAX_RAINDROPS <> RainIntensity Then
            MAX_RAINDROPS = RainIntensity
            ReDim DropRain(1 To MAX_RAINDROPS) As DropRainRec
            ReDim DropSnow(1 To MAX_RAINDROPS) As DropRainRec
        End If
    End If


------------

Oh and the link for snow isn't working ;)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 24, 2007 8:23 am 
Offline
Knowledgeable
User avatar

Joined: Mon May 29, 2006 11:38 am
Posts: 293
Location: Cambridge, UK
Its because you don't "Add text" in MS. I'm not to sure but I think you need to change it to
Code:
Call globalmsg


Check for other subs, maybe the attack one, and see how the broadcast a global message. And for the snow, make your own in paint.

_________________
Image
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 24, 2007 4:56 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
Sry about all the bugs. That's very old but it was developed for my game, witch is quite different.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 2:04 am 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
Update it xD.

And for the GlobalMsg, already tried that and it gives me an error on it and says..

Wrong number of arguments or invalid property assignments

:(

-----------
EDIT:

MAJOR FIX FOR IT! I fixed it, it just wansn't registering straight so i had compared it to a previous call add text, well heres the correct packet :).

Code:
    If (LCase(Parse(0)) = "weather") Then
        If Val(Parse(1)) = WEATHER_RAINING And GameWeather <> WEATHER_RAINING Then
            Call TextAdd(frmMirage.txtChat, "You see rain drops falling from the sky above!", True)
        End If
        If Val(Parse(1)) = WEATHER_SNOWING And GameWeather <> WEATHER_SNOWING Then
            Call TextAdd(frmMirage.txtChat, "You see snow falling from the sky above!", True)
        End If
       
        If Val(Parse(1)) = WEATHER_NONE Then
            If GameWeather = WEATHER_RAINING Then
                Call TextAdd(frmMirage.txtChat, "The rain beings to calm.", True)
            ElseIf GameWeather = WEATHER_SNOWING Then
                Call TextAdd(frmMirage.txtChat, "The snow is melting away.", True)
            End If
        End If
        GameWeather = Val(Parse(1))
        RainIntensity = 100
        If MAX_RAINDROPS <> RainIntensity Then
            MAX_RAINDROPS = RainIntensity
            ReDim DropRain(1 To MAX_RAINDROPS) As DropRainRec
            ReDim DropSnow(1 To MAX_RAINDROPS) As DropRainRec
        End If
    End If


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 5:39 pm 
Offline
Regular

Joined: Thu Mar 22, 2007 3:32 pm
Posts: 31
This doesn't really fix it,, I used your packet and I still have the error.
---------------------------------------------------------------------------------
EDIT:

I have a RTE 5: Invalid Procedure call or Argument at Line:

Code:
Call DD_BackBuffer.BltFast(DropSnow(i).x + DropSnow(i).Speed, DropSnow(i).y + DropSnow(i).Speed, DD_SnowSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)


In Sub:

Code:

Sub BltWeather()
Dim i As Long

    Call DD_BackBuffer.SetForeColor(RGB(0, 0, 200))
   
    If GameWeather = WEATHER_RAINING Then
        For i = 1 To MAX_RAINDROPS
            If DropRain(i).Randomized = False Then
                If frmMirage.tmrRainDrop.Enabled = False Then
                    BLT_RAIN_DROPS = 1
                    frmMirage.tmrRainDrop.Enabled = True
                    If frmMirage.tmrRainDrop.Tag = "" Then
                        frmMirage.tmrRainDrop.Interval = 200
                        frmMirage.tmrRainDrop.Tag = "123"
                    End If
                End If
            End If
        Next i
    ElseIf GameWeather = WEATHER_SNOWING Then
        For i = 1 To MAX_RAINDROPS
            If DropSnow(i).Randomized = False Then
                If frmMirage.tmrSnowDrop.Enabled = False Then
                    BLT_SNOW_DROPS = 1
                    frmMirage.tmrSnowDrop.Enabled = True
                    If frmMirage.tmrSnowDrop.Tag = "" Then
                        frmMirage.tmrSnowDrop.Interval = 200
                        frmMirage.tmrSnowDrop.Tag = "123"
                    End If
                End If
            End If
        Next i
    Else
        If BLT_RAIN_DROPS > 0 And BLT_RAIN_DROPS <= RainIntensity Then
            Call ClearRainDrop(BLT_RAIN_DROPS)
        End If
        frmMirage.tmrRainDrop.Tag = ""
    End If
   
    'actually blt the rain
    For i = 1 To MAX_RAINDROPS
        If Not ((DropRain(i).x = 0) Or (DropRain(i).y = 0)) Then
            DropRain(i).x = DropRain(i).x + DropRain(i).Speed
            DropRain(i).y = DropRain(i).y + DropRain(i).Speed
            Call DD_BackBuffer.DrawLine(DropRain(i).x, DropRain(i).y, DropRain(i).x + DropRain(i).Speed, DropRain(i).y + DropRain(i).Speed)
            If (DropRain(i).x > (MAX_MAPX + 1) * PIC_X) Or (DropRain(i).y > (MAX_MAPY + 1) * PIC_Y) Then
                DropRain(i).Randomized = False
            End If
        End If
    Next i
       
        'declare snow tile
        rec.top = 0
        rec.Bottom = rec.top + PIC_Y
        rec.Left = 0
        rec.Right = rec.Left + PIC_X
       
        'actualy blt the snow
        For i = 1 To MAX_RAINDROPS
            If Not ((DropSnow(i).x = 0) Or (DropSnow(i).y = 0)) Then
                DropSnow(i).x = DropSnow(i).x + DropSnow(i).Speed
                DropSnow(i).y = DropSnow(i).y + DropSnow(i).Speed
                Call DD_BackBuffer.BltFast(DropSnow(i).x + DropSnow(i).Speed, DropSnow(i).y + DropSnow(i).Speed, DD_SnowSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
                If (DropSnow(i).x > (MAX_MAPX + 1) * PIC_X) Or (DropSnow(i).y > (MAX_MAPY + 1) * PIC_Y) Then
                    DropSnow(i).Randomized = False
                End If
            End If
        Next i
       
    ' If it's raining, make the screen randomly flash white
    If GameWeather = WEATHER_RAINING Then
        If Int((100 - 1 + 1) * Rnd) + 1 = 8 Then
            DD_BackBuffer.SetFillColor RGB(255, 255, 255)
            Call DD_BackBuffer.DrawBox(0, 0, (MAX_MAPX + 1) * PIC_X, (MAX_MAPY + 1) * PIC_Y)
        End If
    End If
End Sub


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 9:03 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
idk o-O, but i was just stating that the fix i posted was for the error on that packet cuz he uses a different way of adding text.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 56 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group