... Current Version ...
@Sven B - Sorry, this won't help your problem any, if anything it's more graphic happy than before...
Fixed a lil problem with the lights
Added more effects in the "party mode"
Added MUSIC!!!!
Added the ability to start and stop the music...
(music courtesy of vgmusic.com)
enjoy!
global diskSpeed as float : diskSpeed = 1.0 : global pegModelOffset = 1000 : global pegTopOffset = 1003 : global blockOffset = 2000 : global tbeamOffset = 3000 : global lightBoxOffset = 4000 : global textureUnitSize as float : textureUnitSize = 25.0 : global MaxLoopTime = 100 : global beamScrollSpd as float : beamScrollSpd = 0.005 : global beamDensity = 8 : global tbeamExtendSpeed as float : tbeamExtendSpeed = 0.05 : global bgColor as integer : bgColor = RGB(168,175,189) : global camRotSpd as float : camRotSpd = 0.05 : global camSmoothing = 100 : global zoomSpd as float : zoomSpd = 0.05 : global maxZoom as float : maxZoom = 50.0 : global FOVangle = 62
flush video memory : sync on : sync rate 0 : set camera fov FOVangle : autocam off : hide mouse : global diskQty as integer : diskQty = 7 : global totMoves as double integer : totMoves = 2^diskQty-1 : global numMoves as integer : numMoves = 0 : global pegSpacing as integer : pegSpacing = int((diskQty*30+50)/10)+1 : global beamScroll as float : beamScroll = 0.0 : global beamCorner as integer : global tbeamExtend as float : tbeamExtend = 0.0 : global tbeamDir as integer : tbeamDir = 0 : global camRotAng as float : global camDis as float : global zoom as float : global lights as integer
global playMusic as integer : global dim pegHolds(3) as integer : pegHolds(1) = diskQty : global dim Adisks(diskQty,3) as float : global dim CamFocus(3) as float : load image "shade2.bmp",10 : load image "edge.bmp",11 : center text screen width()/2,screen height()/2, "Generating Texture(s)" : sync : sync : load music "G_RedAlert_Bigfoot.mid",1 : loop music 1 : playMusic = 1 : gosub texture20 : for n = 1 to diskQty : cls : load object "Disk2.3ds", n : scale object n, (n-1)*15 + 50,100,(n-1)*15 +50 : position object n, 0-pegSpacing, (n)*-2+diskQty*2, 0 : rotate object n, 0, rnd(360), 0 : Adisks(n,1) = object position x(n) : Adisks(n,2) = object position y(n) : Adisks(n,3) = object position z(n) : center text screen width()/2,screen height()/2, "Loading Disk " + str$(n) + " of " + str$(diskQty) : sync
next n : for n = 1 to 3 : cls : load object "cylinder2.3ds",n + pegModelOffset : load object "peg Top2.3ds",n + pegTopOffset : scale object n + pegModelOffset, 15, (diskQty*2 + 2.5) * 10, 15 : scale object n + pegTopOffset, 15, 15, 15 : position object n + pegTopOffset, (n-2)*pegSpacing, diskQty*2 + 1.49,0 : position object n + pegModelOffset, (n-2)*pegSpacing, -1.01,0 : set sphere mapping on n + pegTopOffset, 20 : set sphere mapping on n + pegModelOffset, 20 : scale object texture n + pegTopOffset, 1.0, 0.5 : center text screen width()/2,screen height()/2, "Loading Peg " + str$(n) + " of 3" : sync : next n : load image "StoneFloor.jpg",1,0 : load image "Foil.jpg",2,0 : load image "Grass.jpg",3,0 : read numBlocks : for n = 1 to numBlocks : cls : load object "UnitBox.3ds",n+blockOffset : scale object n+blockOffset,datread(),datread(),datread() : position object n+blockOffset,datread(),datread(),datread() : rotate object n+blockOffset,datread(),datread(),datread()
texture object n+blockOffset,datread() : scale object texture n+blockOffset,datread()/textureUnitSize,datread()/textureUnitSize : center text screen width()/2,screen height()/2, "Loading Scenary Block " + str$(n) + " of "+str$(numBlocks) : sync : next n : global FPS as integer : global GameSpeed as integer : GameSpeed = 60 : global LoopConstant as double float : global LoopTime as integer : global LastLoopTime as integer : LastLoopTime = timer() : global LoopSpeed as double float : LoopSpeed = 1.0 : global FPSISmoothing as integer : FPSISmoothing = 25 : set ambient light 25 : camDis = pegSpacing * 2 + 20 : position camera 0,20, camDis : point camera 0,0,0 : fog on : fog distance 750 : fog color bgColor : color backdrop bgColor : do
numMoves = 0 : solveHanoi(1, 2, 3, diskQty) : numMoves = 0 : solveHanoi(3, 2, 1, diskQty) : loop : end
function solveHanoi(sorce, aux, dest, disks as integer) : if disks <> 0 : solveHanoi(sorce, dest, aux, disks - 1) : moveDisk(sorce, dest, disks) : solveHanoi(aux, sorce, dest, disks - 1) : endif
endfunction : function moveDisk(sorce, dest, disk) : repeat : tmp = rnd(5) : until tmp <> beamCorner and tmp <> 0 : beamCorner = tmp : repeat : update(disk) : until tbeamDir = 2 : repeat : Adisks(disk,2) = Adisks(disk,2) + diskSpeed*LoopSpeed : update(disk) : until Adisks(disk,2) > diskQty*2 + 10 : Adisks(disk,2) = diskQty*2 + 10 : repeat : if Adisks(disk,1) > pegSpacing*(dest-2) : Adisks(disk,1) = Adisks(disk,1) - diskSpeed*LoopSpeed : else : Adisks(disk,1) = Adisks(disk,1) + diskSpeed*LoopSpeed : endif : update(disk) : until Adisks(disk,1) < pegSpacing*(dest-2) + diskSpeed*LoopSpeed/2.0 and Adisks(disk,1) > pegSpacing*(dest-2) - diskSpeed*LoopSpeed/2.0 : Adisks(disk,1) = pegSpacing*(dest-2) : repeat : Adisks(disk,2) = Adisks(disk,2) - diskSpeed*LoopSpeed
update(disk) : until Adisks(disk,2) <= pegHolds(dest)*2 : Adisks(disk,2) = pegHolds(dest)*2 : pegHolds(sorce) = pegHolds(sorce) - 1 : pegHolds(dest) = pegHolds(dest) + 1 : numMoves = numMoves + 1 : tbeamDir = 3 : repeat : update(disk) : until tbeamDir = 0
endfunction : function update(activeDisk) : repeat : if activeDisk <> 0 : position object activeDisk,Adisks(activeDisk,1),Adisks(activeDisk,2),Adisks(activeDisk,3) : if 0 = activeDisk mod 2 : rotate object activeDisk, 0, object angle y(activeDisk) + (0.1 - rnd(0.1))*LoopSpeed,0 : else : rotate object activeDisk, 0, object angle y(activeDisk) - (0.1 + rnd(0.1))*LoopSpeed,0 : endif : if beamCorner = 1 : tBeam(75, 75, 75, object position x(activeDisk), object position y(activeDisk), object position z(activeDisk), activeDisk + 4,0) : endif : if beamCorner = 2 : tBeam(-75, 75, -75, object position x(activeDisk), object position y(activeDisk), object position z(activeDisk), activeDisk + 4,1) : endif : if beamCorner = 3 : tBeam(75, 75, -75, object position x(activeDisk), object position y(activeDisk), object position z(activeDisk), activeDisk + 4,2) : endif : if beamCorner = 4 : tBeam(-75, 75, 75, object position x(activeDisk), object position y(activeDisk), object position z(activeDisk), activeDisk + 4,3) : endif : if beamCorner = 5 : tBeam(0, 75, 0, object position x(activeDisk), object position y(activeDisk), object position z(activeDisk), activeDisk + 4,4) : endif
endif : for n = 1 to 3 : scroll object texture n + pegTopOffset, 0, beamScrollSpd * loopSpeed * 2.0 : scroll object texture n + pegModelOffset, beamScrollSpd * loopSpeed * -2.0, 0 : next n : LoopTime = timer() - LastLoopTime : LastLoopTime = timer() : if LoopTime > MaxLoopTime : LoopTime = MaxLoopTime : endif : LoopConstant = GameSpeed/1000.0 : LoopSpeed = (LoopSpeed*(FPSISmoothing-1.0) + (LoopTime * LoopConstant * 1.0)) / FPSISmoothing*1.0 : FPS = screen fps() : text 10,10,str$(numMoves) + " / " + str$(totMoves) + " Moves Made" : text 10,25,"Press Up Key and Down Key to zoom in and out" : text 10,40,"Press Return Key to toggle spinning lights, backdrop and fog" : text 10,55,"Screen FPS: " + str$(FPS) : if playMusic = 1 : text 10,70,"Press 'M' to stop music" : else : text 10,70,"Press 'M' to play music" : endif : text 10,85,"On Screen Polygons: " + str$(Statistic(1)) : camRotAng = camRotAng + camRotSpd * loopSpeed : position camera cos(camRotAng) * camDis, 20, sin(camRotAng) * camDis
if lights = 1 : position light 1, cos(camRotAng*27) * 45.0, sin(camRotAng*27*5)*5+15, sin(camRotAng*27) * 45.0 : position light 2, cos(camRotAng*-17) * (camDis+10), sin(camRotAng*-17*5)*5+15, sin(camRotAng*-17) * (camDis+10) : position light 3, cos(camRotAng*-27) * 100.0, sin(camRotAng*-27*4)*5+15, sin(camRotAng*-27) * 100.0 : fog color sin(camRotAng*10)*100+100,sin(camRotAng*15)*100+100,sin(camRotAng*10+90)*100+100 : color backdrop rgb(sin(camRotAng*10)*100+100,sin(camRotAng*15)*100+100,sin(camRotAng*10+90)*100+100) : position object lightBoxOffset, light position x(1), light position y(1), light position z(1) : position object lightBoxOffset+1, light position x(2), light position y(2), light position z(2) : position object lightBoxOffset+2, light position x(3), light position y(3), light position z(3) : endif : CamFocus(1) = (object position x(activeDisk) + CamFocus(1)*(camSmoothing-1.0)*1.0) / camSmoothing*1.0 : CamFocus(2) = (object position y(activeDisk) + CamFocus(2)*(camSmoothing-1.0)*1.0) / camSmoothing*1.0 : CamFocus(3) = (object position z(activeDisk) + CamFocus(3)*(camSmoothing-1.0)*1.0) / camSmoothing*1.0 : point camera CamFocus(1), CamFocus(2), CamFocus(3) : if upkey() = 1 : if zoom < 1.0 : zoom = zoom + zoomSpd*LoopSpeed : else : zoom = 1.0 : endif : set camera fov FOVangle-maxZoom*zoom : endif : if downkey() = 1 : if zoom > 0.0 : zoom = zoom - zoomSpd*LoopSpeed
if zoom <= 0.0 : zoom = 0.0 : endif : set camera fov FOVangle-maxZoom*zoom : endif : endif : if returnkey() = 1 and lights = 1 : lights = 3 : else : if returnkey() = 0 and lights = 2 : make light 1 : set point light 1, 0,0,0 : color light 1, 255, 0, 0 : make light 2 : set point light 2, 0,0,0 : color light 2, 0, 255, 0 : make light 3 : set point light 3, 0,0,0 : color light 3, 0, 0, 255 : make object sphere lightBoxOffset,5, 5,5 : color object lightBoxOffset , rgb(255,0,0) : ghost object on lightBoxOffset : make object sphere lightBoxOffset+1,5,5,5 : color object lightBoxOffset+1, rgb(0,255,0) : ghost object on lightBoxOffset+1
make object sphere lightBoxOffset+2,5,5,5 : color object lightBoxOffset+2, rgb(0,0,255) : ghost object on lightBoxOffset+2 : fog distance 750 : for n = 1 to diskQty : set object diffuse n,rgb(255,192,0) : next n : lights = 1 : endif : if returnkey() = 0 and lights = 3 : for n = 1 to 3 : position light n, 10000,10000,10000 : next n : sync : for n = 1 to 3 : delete light n : delete object lightBoxOffset+n-1 : next n : for n = 1 to diskQty : set object diffuse n,rgb(255,255,255) : next n : lights = 0 : fog color bgColor : color backdrop bgColor : fog distance 750
endif : if returnkey() = 1 and lights = 0 : lights = 2 : endif : endif : if playMusic = 1 and keystate(50) = 1 : playMusic = 2 : endif : if playMusic = 3 and keyState(50) = 0 : playMusic = 4 : endif : if playMusic = 4 and keyState(50) = 1 : playMusic = 5 : endif : if playMusic = 5 and keyState(50) = 0 : loop music 1 : playMusic = 1 : endif : if playMusic = 2 : stop music 1 : playMusic = 3 : endif : sync : until spacekey() = 0 or tbeamDir = 0
endfunction : function tBeam(sx as float, sy as float, sz as float, ex as float, ey as float, ez as float, size as float, qtyNum) : for n = 0 to beamDensity : if object exist(tbeamOffset+n+qtyNum*beamDensity) : delete object tbeamOffset+n+qtyNum*beamDensity : endif : next n : beamScroll = beamScroll - beamScrollSpd * loopSpeed : if tbeamDir = 4 : tbeamExtend = tbeamExtend - tbeamExtendSpeed*LoopSpeed : ex = ((ex - sx) * tbeamExtend) + sx : ey = ((ey - sy) * tbeamExtend) + sy : ez = ((ez - sz) * tbeamExtend) + sz : size = size * tbeamExtend : if tbeamExtend <= 0.0 : tbeamDir = 0 : tbeamExtend = 0.0 : endif : endif : if tbeamDir = 3 : tbeamExtend = tbeamExtend - tbeamExtendSpeed*LoopSpeed : if tbeamExtend <= 0 : tbeamDir = 4 : tbeamExtend = 1.0 : endif
endif : if tbeamDir = 1 : tbeamExtend = tbeamExtend + tbeamExtendSpeed*LoopSpeed : if tbeamExtend >= 1.0 : tbeamDir = 2 : endif : endif : if tbeamDir = 0 : tbeamExtend = tbeamExtend + tbeamExtendSpeed*LoopSpeed : ex = ((ex - sx) * tbeamExtend) + sx : ey = ((ey - sy) * tbeamExtend) + sy : ez = ((ez - sz) * tbeamExtend) + sz : size = size * tbeamExtend : if tbeamExtend >= 1.0 : tbeamDir = 1 : tbeamExtend = 0.0 : endif : endif : for n = 1 to beamDensity : make object triangle tbeamOffset+n+qtyNum*beamDensity, sx, sy, sz, newXvalue(ex, (360.0/beamDensity)*n, size), ey, newZvalue(ez, (360.0/beamDensity)*n, size), newXvalue(ex, (360.0/beamDensity)*(n-1), size), ey, newZvalue(ez, (360.0/beamDensity)*(n-1), size) : ghost object on tbeamOffset+n+qtyNum*beamDensity : texture object tbeamOffset+n+qtyNum*beamDensity, 20 : scroll object texture tbeamOffset+n+qtyNum*beamDensity, beamScroll, 0 : disable object zwrite tbeamOffset+n+qtyNum*beamDensity : next n
if tbeamDir = 1 or tbeamDir = 2 or tbeamDir = 3 : make object sphere tbeamOffset+qtyNum*beamDensity, 2 : position object tbeamOffset+qtyNum*beamDensity, ex, ey, ez : if tbeamDir <> 2 : scale object tbeamOffset+qtyNum*beamDensity, size*135*tbeamExtend, 180*tbeamExtend, size*135*tbeamExtend : else : scale object tbeamOffset+qtyNum*beamDensity, size*135, 180, size*135 : endif : ghost object on tbeamOffset+qtyNum*beamDensity : set object light tbeamOffset+qtyNum*beamDensity, 0 : texture object tbeamOffset+qtyNum*beamDensity, 20 : scroll object texture tbeamOffset+qtyNum*beamDensity, 0, beamScroll : endif
endfunction : function datread() : local rtrn as float : read rtrn
endfunction rtrn : texture20: : create bitmap 1,256,256 : cls : set current bitmap 1 : for n = 1 to 256 : for m = 1 to 256 : if rnd(5) >= 1 : dot n,m,rgb(rnd(50),rnd(100)+155,rnd(100)+155) : endif : next m : next n : blur bitmap 1,6 : get image 20,0,0,256,256 : set current bitmap 0 : delete bitmap 1 : return : data 18, 200,5,200, 0,-3.5,0, 0,0,0, 1, 200,200, 240,5,240, 0,-8.5,0, 0,0,0, 1, 240,240, 280,5,280, 0,-13.5,0, 0,0,0, 1, 280,280, 320,5,320, 0,-18.5,0, 0,0,0, 1, 320,320, 750,5,750, 0,-23.5,0, 0,0,0, 3, 750,750, 10,200,750, 370,73.5,0, 0,0,0, 1, 750,200, 10,200,750, -370,73.5,0, 0,0,0, 1, 750,200, 10,200,750, 0,73.5,370, 0,90,0, 1, 750,200, 10,200,750, 0,73.5,-370, 0,90,0, 1, 750,200, 200,5,200, 0,75,0, 0,0,0, 1, 200,200, 25,76,25, 85,37,85, 0,0,0, 1, 25,76, 25,76,25, -85,37,85, 0,0,0, 1, 25,76, 25,76,25, 85,37,-85, 0,0,0, 1, 25,76, 25,76,25, -85,37,-85, 0,0,0, 1, 25,76, 170,20,10, 0,71,-85, 0,0,0, 2, 170,20, 170,20,10, 0,71,85, 0,0,0, 2, 170,20, 170,20,10, 85,71,0, 0,90,0, 2, 170,20, 170,20,10, -85,71,0, 0,90,0, 2, 170,20
CPU
- Again, don't forget the media!
[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\[center]