I've played around with this a bit more, and here's my solution to the problem:
Engines
AS _BYTE 'Engines remaining 0-4 Vents
AS _BYTE 'Vents remaining 0-16 (0 explodes ship) Silos
AS _BYTE 'Silos remaining 0-5 ShotsFired
AS _BYTE 'how may shots are currently active Ships
AS _BYTE 'Dreadnaughts destroied Distance
AS _BYTE 'Dreadnaught Distance remaining
CONST TRUE
= -1, FALSE
= NOT TRUE
, SPRITES
= 0, MASK
= 3 CONST Shot
= 1, Bomb
= 2, SGun
= 3, LGun
= 4, STorp
= 5, LTorp
= 6, Trakr
= 7
Layer
(0) = _LOADIMAGE("DFsprit8.bmp") ' Sprite LayerLayer
(2) = _NEWIMAGE(640, 480, 32) 'ship draw layerLayer
(3) = _NEWIMAGE(640, 480, 32) 'screen mask, top 32 and bottom 80 pixels masked
LINE (0, 464)-(639, 479), _RGB32(1, 1, 1), BF
'debugging
LoadDreadnaughtlayout
Xloc!
= 1000: start!
= TIMERLimit% = 200
DrawDreadnaught Xloc!, -32, 2
PRINT "MoveStep:"; Xstep!
ClearLayer 2
IF f%
< Limit%
THEN Xstep!
= Limit%
/ f%
ELSE Xstep!
= 1 Xloc! = Xloc! - Xstep!
IF Xloc!
<= -1000 THEN Xloc!
= 1000 c% = c% + 10
Delta:
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0T
,0V
,0F,0A
,0A
,0I
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0T
,0F,0A
,0A
,0A
,0A
,0A
,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0T
,0F,0A
,0A
,0A
,0A
,0A
,0A
,0A
,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,0T
,0F,0A
,0A
,0A
,0A
,0A
,1T
,1V
,1V
,1U
,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,0T
,0F,0A
,0A
,0A
,0A
,0A
,1T
,1F,1A
,1A
,1A
,1A
,0A
DATA 00,00,00,00,00,00,00,00,00,0T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00,00,00,00,00,00,00,0J
,0G
,0A
,0A
,0A
,0A
,0A
,1J
,1G
,1A
,1A
,1A
,1A
,1A
,1A
,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,0J
,0G
,0A
,0A
,0A
,0A
,0A
,1J
,1G
,1A
,1A
,1A
,1A
,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,0J
,0G
,0A
,0A
,0A
,0A
,0A
,1J
,1W
,1W
,1K
,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0J
,0G
,0A
,0A
,0A
,0A
,0A
,0A
,0A
,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0J
,0G
,0A
,0A
,0A
,0A
,0A
,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,0J
,0W
,0G
,0A
,0A
,0H
DeltaWepondry:
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2G
,00,00,0E
,0F,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2A
,00,00,00,00,1E
,1F,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2E
,00,00,0I
,0J
,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,2A
,00,00,0I
,0J
,00,00,00,0E
,0F,00,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,2G
,00,00,0I
,0J
,00,00,2A
,00,00,1E
,1F,00,1A
DATA 00,00,00,00,00,00,00,00,00,2A
,00,00,0I
,0J
,00,00,0E
,0F,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,2E
,00,00,0I
,0J
,00,00,00,00,1E
,1F,00,00,2A
,00,0M
,00,00 DATA 00,00,00,00,00,2A
,00,00,0I
,0J
,00,00,00,00,2A
,00,00,00,00,00,2A
,00,1M
,00,0A
DATA 00,00,00,2A
,00,00,0I
,0J
,00,00,00,2A
,00,00,00,2C
,00,0M
,2A
,0I
,0J
,00,2C
,00,1A
DATA 00,2A
,00,0E
,0F,00,0M
,00,2A
,00,0E
,0F,00,00,00,0C
,00,1M
,2A
,00,00,00,0C
,00,00 DATA 00,2A
,00,1E
,1F,00,1M
,00,2A
,00,1E
,1F,00,00,00,1C
,00,0M
,2A
,00,00,00,1C
,00,00 DATA 00,00,00,2A
,00,00,0I
,0J
,00,00,00,2A
,00,00,00,2C
,00,1M
,2A
,0I
,0J
,00,2C
,00,0A
DATA 00,00,00,00,00,2A
,00,00,0I
,0J
,00,00,00,00,2A
,00,00,00,00,00,2A
,00,0M
,00,1A
DATA 00,00,00,00,00,00,00,2E
,00,00,0I
,0J
,00,00,00,00,0E
,0F,00,00,2A
,00,1M
,00,00 DATA 00,00,00,00,00,00,00,00,00,2A
,00,00,0I
,0J
,00,00,1E
,1F,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,2G
,00,00,0I
,0J
,00,00,2A
,00,00,0E
,0F,00,0A
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,2A
,00,00,0I
,0J
,00,00,00,1E
,1F,00,1A
DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2E
,00,00,0I
,0J
,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2A
,00,00,00,00,0E
,0F,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2G
,00,00,1E
,1F,00 DATA 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
SUB DrawDreadnaught
(Xloc%
, Yloc%
, LayerID%%
) 'find last tile to display
Endx%% = (640 - Xloc%) \ 32
Endy%% = (400 - Yloc%) \ 32
'range check keep values within array size(or dreadnaught data size)
IF Endx%%
> S.Xsize
THEN Endx%%
= S.Xsize
IF Endy%%
> S.Ysize
THEN Endy%%
= S.Ysize
'find first tile to display
Startx%% = Xloc% \ 32
Starty%% = Yloc% \ 32
'make sure value is always negative(-) otherwise start at 0
IF Startx%%
> 0 THEN Startx%%
= 0 IF Starty%%
> 0 THEN Starty%%
= 0 'fix negative value to positive, this means that portion is off screen so
'start at the + array location in other words don't bother with whats off
'screen
Startx%% = -Startx%%
Starty%% = -Starty%%
FOR y%
= Starty%%
TO Endy%%
YL% = Yloc% + y% * 32
FOR x%
= Startx%%
TO Endx%%
layer% = Ship(x%, y%, 0)
x1% = Xloc% + x% * 32
xoff% = 16 * (Ship(x%, y%, 1) - 65)
XL% = x1% + xoffs%
IF layer%
> 0 THEN _PUTIMAGE (XL%
, YL%
)-STEP(32, 32), Layer
(SPRITES
), Layer
(LayerID%%
), (0, 0 + ((layer%
- 1) * 16))-STEP(15, 15) _PUTIMAGE (XL%
, YL%
)-STEP(32, 32), Layer
(SPRITES
), Layer
(LayerID%%
), (0 + xoff%
, 0 + (layer%
* 16))-STEP(15, 15) layer% = Arms(x%, y%, 0) + 4
xoff% = 16 * (Arms(x%, y%, 1) - 65)
XL% = x1% + xoffs%
_PUTIMAGE (XL%
, YL%
)-STEP(32, 32), Layer
(SPRITES
), Layer
(LayerID%%
), (0 + xoff%
, layer%
* 16)-STEP(15, 15)
SUB LoadDreadnaughtlayout
Code has been cleaned up and math routines reduced as much as possible inside the graphic display portion, with no effect to display. (WTH went wrong last time is beyond me. Probably just something simple that I'm just too lazy to notice ATM.)
FPS counter has been replaced from a 1 second counter to a 1/10th second counter.
With this 1/10th counter, we now utilize a Limit% to set the maximum speed that we want the game to run. On my PC, I've set the speed to 200 so I can watch the movement step in action. A FPS of 120 or less doesn't require the movement to change at all now.
Changed the _PRINTSTRING to a lazy LOCATE and PRINT so that I could tag on some information without having to use my brain... I imagine eventually they'll disappear completely once debugging is finished, so it shouldn't really matter.
Fixed _DELAY changed to variable _LIMIT for better use of maximum CPU power when the game needs it.
And added in a basic "skipframe" routine so that we maintain game speed even when the PC can't render all the graphics fast enough for us. (Xstep!) For me, the highest this step ever goes is to about 1.7 pixels instead of 1 pixel, so it's not a noticeable change at all. Instead of the ship moving 1 pixel, 20 times in 1/10 of a second, to make 200 FPS, it ends up moving 1.7 pixels, 12 times in 1/10th of a seconds, to make 200 FPS, at its most taxed operation.
The change there just isn't very significant visually for me, but it keeps the game scrolling smoothly and without slowing down.
1 pixel, 20 times, in 1/10th of a second vs...
1.7 pixels, 12 times, in that same time frame...
And, if you think the game runs best at 100 FPS, then there's no change at all for us. We'd run 1 pixel, 10 times, in 1/10 of a second, all the time. (At least on my PC we would...)
It's the best solution I can think of for you, so the game can run smoothly on both older and newer machines. ;)