wahay! a little reading up suggested goto was depricated if using strict mode, so i seperated into 2 functions and strict mode started telling me of a few typo's. fixed them, altered the arrays a little, and voila all is working!
took more work than i expected to port this thing over, but its finally running and i take it all back - can't blame a "buggy compiler" now hehe.
cheers guys. current working code is below if interested. not quite a screensaver yet though as i need to find a way to read o/s specific params passed when launching a screensaver... and currently i only know of win32 params (/c, -c, /p, -p, etc.).
Rem
Written in BlitzMax 1.08 on GNU Linux.
AuroraSaver - Aurora northern lights screensaver by Freefornow.co.uk
Copyright (C) 2005 Richard Grant
EMail: <email removed for web crawlers>
Address: <address removed for web crawlers>
This program is free software; you can redistribute it And/Or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, Or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY Or FITNESS For A PARTICULAR PURPOSE. See the
GNU General Public License For more details.
You should have received a copy of the GNU General Public License
along with this program; If Not, write To the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
EndRem
Framework BRL.glMax2D
Import BRL.Random
Import BRL.StandardIO
Import BRL.System
Strict
Global width = 400, height = 300
Local mode = 16
If Not GraphicsModeExists(400, 300, 16)
If GraphicsModeExists(400, 300, 24)
mode = 24
Else
width = 800
height = 600
If Not GraphicsModeExists(800, 600, 16)
If GraphicsModeExists(800, 600, 24)
mode = 24
Else
RuntimeError "Cannot initialise a suitable resolution; Execution has terminated!"
End
EndIf
EndIf
EndIf
EndIf
Global grid_x = 0, grid_y = 0
Global one_fourth_width = width / 4, one_fourth_height = height / 4
Global three_fourth_width = one_fourth_width * 3, three_fourth_height = one_fourth_height * 3
Global half_width = width / 2, half_height = height / 2
Global x_plus = 0, x_less = 0, y_plus = 0, y_less = 0
Global loops = 0, finished_fading = 0, colour = 0
Global colour_chosen:String = "g"
Global xy_colour:String[width + 1, height + 1], xy_position[width + 1, height + 1]
SeedRnd MilliSecs()
Repeat
grid_x = Rnd(0, width)
grid_y = Rnd(0, height)
Until grid_x < one_fourth_width Or grid_x > three_fourth_width Or grid_y < one_fourth_height Or grid_y > three_fourth_height
place_particle()
Graphics width, height, mode
HideMouse()
MoveMouse(half_width, half_height)
While MouseX() = 0 Or MouseY() = 0
Wend
While (GetChar() + MouseHit(1) + MouseHit(2) + MouseHit(3) + MouseZ() = 0) And MouseX() = half_width And MouseY() = half_height
If loops = 1000
finished_fading = 1
For grid_x = 0 To width
For grid_y = 0 To height
If xy_position[grid_x, grid_y] > 0
finished_fading = 0
If xy_position[grid_x, grid_y] < 6
xy_position[grid_x, grid_y] = 0
Else
xy_position[grid_x, grid_y] = xy_position[grid_x, grid_y] - 5
EndIf
draw_particle()
EndIf
Next
Next
If finished_fading = 1
loops = 0
Cls
generate_particle()
EndIf
Else
loops = loops + 1
If loops Mod 150 = 0 Then generate_particle()
For grid_x = 0 To width
For grid_y = 0 To height
If xy_position[grid_x, grid_y] = 0
If Int(Rnd(0, 3)) = 0 Then check_particle()
Else
xy_position[grid_x, grid_y] = xy_position[grid_x, grid_y] - 1
draw_particle()
EndIf
Next
Next
EndIf
FlushMem
Flip
Wend
End
Function check_particle()
x_less = grid_x - 1
x_plus = grid_x + 1
y_less = grid_y - 1
y_plus = grid_y + 1
If grid_x > 0
If xy_position[x_less, grid_y] > 30
colour_chosen = xy_colour[x_less, grid_y]
check_particle_b()
Return
EndIf
If grid_y > 0
If xy_position[x_less, y_less] > 30
colour_chosen = xy_colour[x_less, y_less]
check_particle_b()
Return
EndIf
EndIf
If grid_y < height
If xy_position[x_less, y_plus] > 30
colour_chosen = xy_colour[x_less, y_plus]
check_particle_b()
Return
EndIf
EndIf
EndIf
If grid_x < width
If xy_position[x_plus, grid_y] > 30
colour_chosen = xy_colour[x_plus, grid_y]
check_particle_b()
Return
EndIf
If grid_y > 0
If xy_position[x_plus, y_less] > 30
colour_chosen = xy_colour[x_plus, y_less]
check_particle_b()
Return
EndIf
EndIf
If grid_y < height
If xy_position[x_plus, y_plus] > 30
colour_chosen = xy_colour[x_plus, y_plus]
check_particle_b()
Return
EndIf
EndIf
EndIf
If grid_y > 0
If xy_position[grid_x, y_less] > 30
colour_chosen = xy_colour[grid_x, y_less]
check_particle_b()
Return
EndIf
EndIf
If grid_y < height
If xy_position[grid_x, y_plus] > 30
colour_chosen = xy_colour[grid_x, y_plus]
check_particle_b()
Return
EndIf
EndIf
EndFunction
Function check_particle_b()
If grid_x > 0
If xy_position[x_less, grid_y] = 0
place_particle()
Return
EndIf
If grid_y > 0
If xy_position[x_less, y_less] = 0
place_particle()
Return
EndIf
EndIf
If grid_y < height
If xy_position[x_less, y_plus] = 0
place_particle()
Return
EndIf
EndIf
EndIf
If grid_x < width
If xy_position[x_plus, grid_y] = 0
place_particle()
Return
EndIf
If grid_y > 0
If xy_position[x_plus, y_less] = 0
place_particle()
Return
EndIf
EndIf
If grid_y < height
If xy_position[x_plus, y_plus] = 0
place_particle()
Return
EndIf
EndIf
EndIf
If grid_y > 0
If xy_position[grid_x, y_less] = 0
place_particle()
Return
EndIf
EndIf
If grid_y < height
If xy_position[grid_x, y_plus] = 0
place_particle()
Return
EndIf
EndIf
EndFunction
Function place_particle()
xy_position[grid_x, grid_y] = 100
xy_colour[grid_x, grid_y] = colour_chosen
EndFunction
Function draw_particle()
Select xy_colour[grid_x, grid_y]
Case "g"
SetColor(0, xy_position[grid_x, grid_y], 0)
Case "r"
SetColor(xy_position[grid_x, grid_y], 0, 0)
Case "y"
SetColor(xy_position[grid_x, grid_y], xy_position[grid_x, grid_y], 0)
EndSelect
DrawRect(grid_x - 1, grid_y - 1, 2, 2)
EndFunction
Function generate_particle()
Repeat
grid_x = Rnd(0, width)
grid_y = Rnd(0, height)
Until grid_x < one_fourth_width Or grid_x > three_fourth_width Or grid_y < one_fourth_height Or grid_y > three_fourth_height
If xy_position[grid_x, grid_y] = 0
colour = Rnd(0, 11)
Select True
Case colour <= 5
colour_chosen = "g"
Case colour >= 6 And colour <=9
colour_chosen = "r"
Default
colour_chosen = "y"
EndSelect
place_particle()
EndIf
EndFunction