Mirage Source http://web.miragesource.net/forums/ |
|
I'm no good with optimizations.. http://web.miragesource.net/forums/viewtopic.php?f=193&t=6300 |
Page 1 of 1 |
Author: | Matt [ Wed Oct 14, 2009 4:31 pm ] |
Post subject: | I'm no good with optimizations.. |
http://web.miragesource.com/old-tutoria ... 20Tut.html What would it take to properly optimize this system? |
Author: | Matt [ Wed Oct 14, 2009 4:49 pm ] |
Post subject: | Re: I'm no good with optimizations.. |
Code: Sub BltWeather()
Dim i As Long If WeatherTick = 0 Then WeatherTick = GetTickCount End If Call DDS_BackBuffer.SetForeColor(RGB(255, 255, 255)) 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 Else If BLT_RAIN_DROPS > 0 And BLT_RAIN_DROPS <= RainIntensity Then Call ClearRainDrop(BLT_RAIN_DROPS) End If frmMirage.tmrRainDrop.Tag = "" End If LeftRight = 0 '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 DDS_BackBuffer.DrawLine(ConvertMapX(DropRain(i).X), ConvertMapY(DropRain(i).Y), ConvertMapX(DropRain(i).X + DropRain(i).speed), ConvertMapY(DropRain(i).Y + DropRain(i).speed)) If (DropRain(i).X > (Map.MaxX + 1) * PIC_X) Or (DropRain(i).Y > (Map.MaxY + 1) * PIC_Y) Then DropRain(i).Randomized = False End If End If Next i End Sub |
Author: | genusis [ Wed Oct 14, 2009 5:30 pm ] |
Post subject: | Re: I'm no good with optimizations.. |
hmm 0.0 Id say What you got there is close just get rid of the timer and make it Get tick. also Type DropRainRec x as long y as long speed as byte Randomized as byte End Type use byte instead of Boolean ^^. 1 or 0 Would work =]. and in the MapRec add Weather() As byte 1 rain 2 thundering rain 3 snow ^^ you can Make them public Consent ^^ as well for the max amount of drops Public Const MAX_BLTDROPS As Byte = 100 Reason for Adding to map is to allow Each map to be able to have a different Weather. like Mountains with snow then walk off rain forest woot. You could also add a Gettickcount to Count down, to turn the Drops on and off for each map and Have a set variable In the map editor for it =]. If you ask why i use byte instead of Boolean because i think its faster ^^. |
Author: | Matt [ Wed Oct 14, 2009 5:43 pm ] |
Post subject: | Re: I'm no good with optimizations.. |
Most of that is already done with this system.. |
Author: | genusis [ Wed Oct 14, 2009 5:55 pm ] |
Post subject: | Re: I'm no good with optimizations.. |
from what i see you still got frmMirage.tmrRainDrop.Enabled = True get rid of all timers =[ they are bad. |
Author: | Matt [ Wed Oct 14, 2009 6:29 pm ] |
Post subject: | Re: I'm no good with optimizations.. |
I said most. And I know timers are bad. I just wanted to get the other part fixed BEFORE I did that. Anyways, thanks to Jacob, this is fixed. |
Author: | Jacob [ Wed Oct 14, 2009 7:04 pm ] |
Post subject: | Re: I'm no good with optimizations.. |
Posting in a locked topic! |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |