Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
P*P scroller. No libs no Call absolute.
#1
Just SetVideoSeg.

Found this last night in the maze that is called my HD. And since I'm sick and tired of replying to emails telling me to make a pureQB scroller, can you guys put this online or in the FAQ?

[code]
'April 9,2003
'Zelda type scrolling tutorial by
'Richard Eric M. Lope aka Relsoft
'SetVideoSEG by Plasma357
'GFX by L_O_J

'No LIBS scroller using SETVIDEOSEG
'Someone requested it so here it is. ;*)

'What you need:
'1.Any version of QB(tested only in QB 4.5 but should work fine in any ver)

'I've commented the code as much as I could ;*)

'PS. I'll release a version that uses external files after this and
'will make a future version with Objects/NPC's if people like it.

DECLARE SUB AF.Print (Xpos%, Ypos%, Text$, col%)
DECLARE SUB Engine.DrawStatBar ()
DECLARE SUB GenMask (Array%(), ArrayIndex%(), Mask%(), MaskIndex%())
DECLARE SUB SetVideoSeg (Segment%)
DECLARE SUB Engine.InitVars ()
DECLARE SUB Engine.DoControls (Finval%)
DECLARE SUB Engine.Main ()
DECLARE SUB Engine.MovePlayer (Player AS ANY)
DECLARE SUB Engine.DrawPlayer (Player AS ANY)
DECLARE SUB Engine.InitHero (NewObject AS ANY)
DECLARE SUB Engine.DrawScreen ()
DECLARE SUB Engine.UpdateCamera (Level AS ANY, Player AS ANY)
DECLARE SUB Engine.DrawMap ()
DECLARE SUB Engine.InitLevel ()
DECLARE FUNCTION Engine.TileCollide% (Player AS ANY)
DECLARE SUB Engine.LoadMap ()
DECLARE SUB Engine.LoadDATA ()
DECLARE SUB InitImageData (FileName$, ImageArray%())
DECLARE SUB MakeImageIndex (ImageArray%(), IndexArray%())
DECLARE SUB AF.LoadPalPp256 (File$)
DECLARE FUNCTION AF.FastKB% ()



DEFINT A-Z
REM $DYNAMIC

'========Declare types here
TYPE SpriteType
id AS INTEGER 'id[unused]
X AS INTEGER 'World X pos
Y AS INTEGER
oldX AS INTEGER 'Snapback values
oldY AS INTEGER
Xv AS INTEGER 'X Speed
Yv AS INTEGER 'Y speed
Active AS INTEGER
Frame AS INTEGER 'Frame in tile where to draw
MinFrame AS INTEGER '[unused]
NumFrame AS INTEGER '[unused]
Move AS INTEGER 'if the sprite is moving?
Counter AS INTEGER 'misc counter
Direction AS INTEGER 'we will use this Smile
DirChanged AS INTEGER 'if it changed direction
oldDir AS INTEGER '
TileX AS INTEGER 'Tile where the Player is on
TileY AS INTEGER
Collide AS INTEGER '[unused]
Speed AS INTEGER 'player stride speed
END TYPE


TYPE LevelType
Xmax AS INTEGER 'Maximum Number of Tiles a Map has
Ymax AS INTEGER
CamX AS INTEGER 'Pixel*Pixel Camera Position
CamY AS INTEGER
TileX AS INTEGER 'Tile postion of Camera
TileY AS INTEGER 'Calculated by CAMX\TileSize(16*16)
Xpos AS INTEGER 'Pixel position Inside the Tile
Ypos AS INTEGER '0 to 15 (used for Scrolling)
END TYPE


TYPE MapLayerType
BaseL AS INTEGER 'Farthest layer
FringeL AS INTEGER '[unused]
TiltL AS INTEGER '[unused]
END TYPE


'KEY CONSTANTS
CONST KEYESC = 1, KEYENTER = 28, KEYSPACE = 57, KEYTAB = &HF
CONST KEYUP = 72, KEYDOWN = 80, KEYLEFT = 75, KEYRIGHT = 77

'Of course!!!!! Smile
CONST FALSE = 0, TRUE = NOT FALSE
CONST VIDEO = &HA000

'Screen constants(Full Screen 320*200)

CONST VWID = 288, VHEI = 160
CONST VMIDx = (VWID \ 2) - 8
CONST VMIDy = (VHEI \ 2) - 8

'Tile dimensions 16*16
CONST TILEW = 16
CONST TILEH = 16

'Number of Tiles per screen 320\16=20,200\16=12
'Used to calculate the DrawMap sub
CONST ScrnTileXmax = VWID \ TILEW
CONST ScrnTileYmax = VHEI \ TILEH

'Map Dimensions change this to suit your needs
'Base this on the MAPDATA dimensions
CONST MapXmax = 35, MapYmax = 26

'Directional constants for easy sprite handling
'DN=Neutral(not Moving), DR=Right...........
CONST DN = 0, DU = 1, DR = 2, DD = 3, DL = 4


RANDOMIZE TIMER

CLS
SCREEN 13
RANDOMIZE TIMER
REDIM SHARED Vpage(32009) 'our buffer
DIM SHARED Map(MapXmax, MapYmax) AS MapLayerType 'Our map

REDIM SHARED HeroSpr(1) AS INTEGER 'The HeroSprite(pp256)
REDIM SHARED HeroSprIndex(1) AS INTEGER 'The HeroSpriteIndex
REDIM SHARED HeroMask(1) AS INTEGER 'The HeroMask(pp256)
REDIM SHARED HeroMaskIndex(1) AS INTEGER 'The HeroMaskIndex


REDIM SHARED Tile(1) AS INTEGER 'The Tiles(pp256)
REDIM SHARED TileIndex(1) AS INTEGER

REDIM SHARED Font(1) AS INTEGER 'The nifty fonts
REDIM SHARED FontIndex(1) AS INTEGER

DIM SHARED Level AS LevelType 'Global level varialble
DIM SHARED Hero AS SpriteType 'our hero

DIM SHARED Layer 'For ease of referencing the draw commands
DIM SHARED VsyncOn 'if we wait for vertical refresh
DIM SHARED StatBarON 'if we want to see the statbar

Layer = VARSEG(Vpage(0)) 'get the SEGMENT of our buffer

Engine.LoadDATA 'Load tiles and palette
Engine.LoadMap 'Load map
Engine.InitVars 'Init some global vars
Engine.InitLevel 'Load level
Engine.InitHero Hero 'Load hero

Vpage(6) = 2560 'Width 320*8
Vpage(7) = 200 'Height
Layer = VARSEG(Vpage(0)) + 1 'Buffer Seg(Ask Plasma)
SetVideoSeg Layer 'Set Draw to Buffer

Engine.Main 'do the scrolling

'Back to system
CLS
SCREEN 0
WIDTH 80
END



FJPALDATA: 'Pp256 palette data(16 color gradient pal.
DATA 0,2752512,10752,2763264,42,2752554,5418,2763306
DATA 1381653,4134165,1392405,4144917,1381695,4134207,1392447,4144959
DATA 0,328965,526344,723723,921102,1118481,1315860,1579032
DATA 1842204,2105376,2368548,2631720,2960685,3289650,3684408,4144959
DATA 0,4,8,12,16,21,25,29
DATA 33,37,42,46,50,54,58,63
DATA 0,262144,524288,786432,1048576,1376256,1638400,1900544
DATA 2162688,2424832,2752512,3014656,3276800,3538944,3801088,4128768
DATA 0,1024,2048,3072,4096,5376,6400,7424
DATA 8448,9472,10752,11776,12800,13824,14848,16128
DATA 0,262148,524296,786444,1048592,1376277,1638425,1900573
DATA 2162721,2424869,2752554,3014702,3276850,3538998,3801146,4128831
DATA 0,263168,526336,789504,1052672,1381632,1644800,1907968
DATA 2171136,2434304,2763264,3026432,3289600,3552768,3815936,4144896
DATA 0,1028,2056,3084,4112,5397,6425,7453
DATA 8481,9509,10794,11822,12850,13878,14906,16191
DATA 0,516,1032,1548,2064,2581,3097,3613
DATA 4385,4901,5418,5934,6450,6966,7482,8255
DATA 0,131076,262152,393228,524304,655381,786457,917533
DATA 1114145,1245221,1376298,1507374,1638450,1769526,1900602,2097215
DATA 0,262656,525312,787968,1050624,1378816,1641472,1904128
DATA 2167040,2429696,2757888,3020544,3283200,3545856,3808512,4136960
DATA 0,131844,263688,395532,527376,659477,791321,923165
DATA 1120545,1252389,1384490,1516334,1648178,1780022,1911866,2109503
DATA 0,131588,263176,394764,526352,657941,789529,921117
DATA 1118497,1250085,1381674,1513262,1644850,1776438,1908026,2105407
DATA 0,515,1030,1545,2060,2575,3090,3605
DATA 4376,4891,5406,5921,6436,6951,7466,8238
DATA 63,2103,4143,6183,8223,10008,12048,14088
DATA 16128,13833,11538,9243,6948,4653,2358,63
DATA 32,1058,2084,3110,4136,5418,6444,7470
DATA 8496,9522,10804,11830,12856,13882,14908,16191

FONTDATA: 'EX-FNT01.PUT image data.
DATA 2752
DATA 64,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,8,31,5406,5405,5404
DATA 5403,5376,25,5376,32,8,31,31,5406,5406,5405,5405,5376,5376,0,0,0,0,0,0
DATA 0,0,48,8,7936,7936,0,7710,7710,30,7424,7445,5397,7196,7196,28,6912,6933,5397,0
DATA 21,21,0,0,0,0,0,0,48,8,0,31,0,7710,7710,30,5405,5405,5397,7196
DATA 7196,28,5376,5403,5403,6682,6682,5402,5376,5401,5397,0,5376,0,64,8,0,0,0,31
DATA 7680,30,7680,5376,7424,5405,29,21,0,7189,5376,0,0,27,6939,0,6656,5376,6682,21
DATA 25,21,5376,21,5376,0,0,0,64,8,7967,7967,31,0,5406,5397,5406,0,5405,7424
DATA 5376,0,7168,7196,21,0,27,5397,27,27,5402,0,6656,5376,6425,6425,25,25,5376,5397
DATA 5397,5376,16,8,31,5406,5405,5376,0,0,0,0,32,8,0,31,7680,5376,29,21
DATA 5404,0,5403,0,6656,0,0,25,0,5376,32,8,31,0,7680,0,0,29,0,5404
DATA 0,5403,6656,5376,25,21,5376,0,48,8,0,0,0,30,30,30,7424,7453,5376,7196
DATA 7196,28,6912,6939,5397,26,5402,26,5376,5376,5376,0,0,0,48,8,0,0,0,0
DATA 30,0,0,5405,0,7196,7196,28,5376,5403,5397,0,5402,0,0,5376,0,0,0,0
DATA 24,8,0,0,0,0,0,0,0,0,0,6400,6144,5376,48,8,0,0,0,0
DATA 0,0,0,0,0,7196,7196,28,5376,5397,5397,0,0,0,0,0,0,0,0,0
DATA 16,8,0,0,0,0,0,0,25,5376,64,8,0,0,0,31,0,0,7680,5376
DATA 0,0,29,21,0,7168,5376,0,0,27,21,0,6656,5376,0,0,25,21,0,0
DATA 5376,0,0,0,64,8,7967,7967,7967,31,5406,5397,7701,5406,5405,0,29,5405,5404,7168
DATA 5376,5404,5403,27,21,5403,6682,5376,0,5402,6425,6425,6425,5401,5376,5397,5397,5397,64,8
DATA 0,7936,0,0,0,7680,21,0,0,7424,21,0,0,7168,21,0,0,6912,21,0
DATA 0,6656,21,0,0,6400,21,0,0,0,21,0,64,8,7967,7967,7967,31,5376,5397
DATA 5397,5406,0,0,0,5405,7196,7196,7196,5404,5403,5397,5397,5397,5402,0,0,0,6425,6425
DATA 6425,25,5376,5397,5397,5397,64,8,7967,7967,7967,31,5376,5397,5397,5406,0,0,0,5405
DATA 7168,7196,7196,5404,0,5397,5397,5403,0,0,0,5402,6425,6425,6425,5401,5376,5397,5397,5397
DATA 64,8,31,0,7936,0,5406,0,7680,21,5405,0,7424,21,5404,0,7168,21,5403,0
DATA 6912,21,6682,6682,6682,26,5376,5397,6421,5397,0,0,0,21,64,8,7967,7967,7967,31
DATA 5406,5397,5397,5397,5405,0,0,0,7196,7196,7196,28,5376,5397,5397,5403,0,0,0,5402
DATA 6425,6425,6425,5401,5376,5397,5397,5397,64,8,7967,7967,7967,31,5406,5397,5397,5397,5405,0
DATA 0,0,7196,7196,7196,28,5403,5397,5397,5403,5402,0,0,5402,6425,6425,6425,5401,5376,5397
DATA 5397,5397,64,8,7967,7967,7967,31,5376,5397,5397,5406,0,0,0,5405,0,0,0,5404
DATA 0,0,0,5403,0,0,0,5402,0,0,0,5401,0,0,0,5376,64,8,7967,7967
DATA 7967,31,5406,5397,5397,5406,5405,0,0,5405,7196,7196,7196,5404,5403,5397,5397,5403,5402,0
DATA 0,5402,6425,6425,6425,5401,5376,5397,5397,5397,64,8,7967,7967,7967,31,5406,5397,5397,5406
DATA 5405,0,0,5405,7196,7196,7196,5404,5376,5397,5397,5403,0,0,0,5402,6425,6425,6425,5401
DATA 5376,5397,5397,5397,16,8,0,0,0,28,5376,0,25,5376,24,8,0,0,0,0
DATA 0,28,0,21,0,6400,6144,5376,40,8,0,7936,0,7680,5376,7424,5376,7168,5404,0
DATA 6912,21,0,6656,0,0,6400,0,0,5376,48,8,0,0,0,0,0,0,7453,7453
DATA 29,5376,5397,5397,6939,6939,27,5376,5397,5397,0,0,0,0,0,0,40,8,31,0
DATA 0,30,0,0,29,0,7168,28,0,5403,21,26,21,25,21,0,21,0,64,8
DATA 7967,7967,7967,31,5376,5397,5397,5406,0,0,0,5405,0,7168,7196,5404,0,6912,5397,5397
DATA 0,0,21,0,0,6400,0,0,0,0,21,0,64,8,7967,7967,7967,31,5406,5397
DATA 5397,5406,5405,7453,29,5405,5404,5404,5404,5404,5403,6939,6939,5403,5402,5376,5397,5397,6425,6425
DATA 6425,25,5376,5397,5397,5397,64,8,0,0,0,31,0,0,7680,5406,0,0,29,5405
DATA 0,7168,5376,5404,0,27,21,5403,6656,6682,6682,5402,25,5397,5397,5401,5376,0,0,5376
DATA 64,8,7967,7967,7967,0,5406,5397,5397,30,5405,0,0,5405,7196,7196,7196,5376,5403,5397
DATA 5397,27,5402,0,0,5402,6425,6425,6425,5401,5376,5397,5397,5397,64,8,7967,7967,7967,31
DATA 5406,5397,5397,5397,5405,0,0,0,5404,0,0,0,5403,0,0,0,5402,0,0,0
DATA 6425,6425,6425,25,5376,5397,5397,5397,64,8,7967,7967,0,0,5406,5397,30,0,5405,0
DATA 7424,0,5404,0,0,28,5403,0,6912,5376,5402,0,26,21,6425,6425,5376,0,5376,5397
DATA 21,0,64,8,7967,7967,7967,31,5406,5397,5397,5397,5405,0,0,0,7196,7196,7196,0
DATA 5403,5397,5397,21,5402,0,0,0,6425,6425,6425,25,5376,5397,5397,5397,64,8,7967,7967
DATA 7967,31,5406,5397,5397,5397,5405,0,0,0,7196,7196,7196,0,5403,5397,5397,21,5402,0
DATA 0,0,5401,0,0,0,5376,0,0,0,64,8,7967,7967,7967,31,5406,5397,5397,5397
DATA 5405,0,0,0,5404,7168,7196,28,5403,0,5397,5403,5402,0,0,5402,6425,6425,6425,5401
DATA 5376,5397,5397,5397,64,8,31,0,0,31,5406,0,0,5406,5405,0,0,5405,7196,7196
DATA 7196,5404,5403,5397,5397,5403,5402,0,0,5402,5401,0,0,5401,5376,0,0,5376,64,8
DATA 0,7967,31,0,0,7680,5397,0,0,7424,21,0,0,7168,21,0,0,6912,21,0
DATA 0,6656,21,0,0,6425,25,0,0,5376,5397,0,64,8,0,7936,7967,31,0,0
DATA 5397,5406,0,0,0,5405,0,0,0,5404,0,0,0,5403,0,0,0,5402,6425,6425
DATA 6425,5401,5376,5397,5397,5397,64,8,31,0,0,31,5406,0,7680,5376,5405,0,29,21
DATA 5404,7168,5376,0,5403,27,27,0,5402,5376,6656,0,5401,0,0,25,5376,0,0,5376
DATA 64,8,31,0,0,0,5406,0,0,0,5405,0,0,0,5404,0,0,0,5403,0
DATA 0,0,5402,0,0,0,6425,6425,6425,25,5376,5397,5397,5397,64,8,31,0,0,31
DATA 7710,0,7680,5406,5405,29,29,5405,5404,7168,5376,5404,5403,0,21,5403,5402,0,0,5402
DATA 5401,0,0,5401,5376,0,0,5376,64,8,31,0,0,31,7710,0,0,5406,5405,29
DATA 0,5405,5404,7168,0,5404,5403,0,27,5403,5402,0,6656,5402,5401,0,0,5401,5376,0
DATA 0,5376,64,8,7967,7967,7967,31,5406,5397,5397,5406,5405,0,0,5405,5404,0,0,5404
DATA 5403,0,0,5403,5402,0,0,5402,6425,6425,6425,5401,5376,5397,5397,5397,64,8,7967,7967
DATA 7967,31,5406,5397,5397,5406,5405,0,0,5405,5404,0,0,5404,6939,6939,6939,5403,5402,5397
DATA 5397,5397,5401,0,0,0,5376,0,0,0,64,8,7967,7967,7967,31,5406,5397,5397,5406
DATA 5405,0,0,5405,5404,7168,0,5404,5403,0,27,5403,5402,0,6656,5376,6425,6425,25,25
DATA 5376,5397,5397,5376,64,8,7967,7967,7967,31,5406,5397,5397,5406,5405,0,0,5405,5404,0
DATA 0,5404,5403,6939,6939,5403,5402,6656,5402,5397,5401,0,6421,25,5376,0,0,5397,64,8
DATA 7967,7967,7967,31,5406,5397,5397,5406,5405,0,0,5376,7196,7196,7196,28,5376,5397,5397,5403
DATA 26,0,0,5402,6425,6425,6425,5401,5376,5397,5397,5397,64,8,7967,7967,7967,31,5376,7701
DATA 5397,5397,0,7424,21,0,0,7168,21,0,0,6912,21,0,0,6656,21,0,0,6400
DATA 21,0,0,0,21,0,64,8,31,0,0,31,5406,0,0,5406,5405,0,0,5405
DATA 5404,0,0,5404,5403,0,0,5403,5402,0,0,5402,6425,6425,6425,5401,5376,5397,5397,5397
DATA 64,8,31,0,0,31,5406,0,7680,5376,5405,0,29,21,5404,7168,5376,0,5403,27
DATA 21,0,6682,5376,0,0,5401,21,0,0,5376,0,0,0,64,8,31,0,0,31
DATA 5406,0,0,5406,5405,7424,0,5405,5404,7168,21,5404,5403,6939,6933,5376,6682,6656,26,21
DATA 5401,6421,5397,0,5376,0,21,0,64,8,31,0,0,31,7680,0,7680,5376,0,29
DATA 29,21,0,7168,5376,0,0,27,27,0,6656,5376,6656,0,25,21,0,25,5376,0
DATA 0,5376,64,8,31,0,0,31,7680,0,7680,5376,0,29,29,21,0,7168,5376,0
DATA 0,6912,21,0,0,6656,21,0,0,6400,21,0,0,0,21,0,64,8,7967,7967
DATA 7967,31,5376,5397,7701,5397,0,0,29,21,0,7168,5376,0,0,27,21,0,6656,5376
DATA 0,0,6425,6425,6425,25,5376,5397,5397,5397,40,8,7967,7967,7680,5397,5397,5405,0,7168
DATA 21,0,5403,0,6656,21,0,6425,6425,0,5397,5397,64,8,31,0,0,0,7680,0
DATA 0,0,0,29,0,0,0,7168,0,0,0,0,27,0,0,0,6656,0,0,0
DATA 0,25,0,0,0,5376,40,8,7967,7967,0,5397,5406,0,7424,21,0,5404,0,6912
DATA 21,0,5402,6425,6425,21,5397,5397,64,8,0,7967,7967,0,7680,6168,6168,30,5917,7959
DATA 5919,7447,5660,5662,5654,7190,5403,5405,5397,6933,5146,7188,5148,6676,6400,4883,4883,25,0,6168
DATA 6168,0,64,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,6425,6425,6425,6425,6168,6168,6168,6168,64,8,7967,7967
DATA 7967,7967,7710,7710,7710,7710,7453,7453,7453,7453,7196,7196,7196,7196,6939,6939,6939,6939,6682,6682
DATA 6682,6682,6425,6425,6425,6425,6168,6168,6168,6168,48,8,0,0,0,0,0,0,0,0
DATA 29,0,7168,5404,0,27,5403,6656,6682,5402,25,5397,5401,5376,0,5376,48,8,0,0
DATA 0,0,0,0,7453,7453,0,5404,5397,28,6939,6939,5376,5402,5397,26,6425,6425,5401,5376
DATA 5397,5397,48,8,0,0,0,0,0,0,7453,7453,29,5404,5397,5397,5403,0,0,5402
DATA 0,0,6425,6425,25,5376,5397,5397,48,8,0,0,0,0,0,0,7453,29,0,5404
DATA 7189,0,5403,0,27,5402,6656,5376,6425,25,21,5376,5397,0,48,8,0,0,0,0
DATA 0,0,7453,7453,29,5404,5397,5397,6939,6939,0,5402,5397,21,6425,6425,25,5376,5397,5397
DATA 48,8,0,0,0,0,0,0,7453,7453,29,5404,5397,5397,6939,6939,0,5402,5397,21
DATA 5401,0,0,5376,0,0,48,8,0,0,0,0,0,0,7453,7453,29,5404,5397,5397
DATA 5403,6939,27,5402,5376,5402,6425,6425,5401,5376,5397,5397,48,8,0,0,0,0,0,0
DATA 29,0,29,5404,0,5404,6939,6939,5403,5402,5397,5402,5401,0,5401,5376,0,5376,48,8
DATA 0,0,0,0,0,0,7424,7453,0,0,5404,21,0,5403,0,0,5402,0,6400,6425
DATA 0,0,5397,21,48,8,0,0,0,0,0,0,0,7453,29,0,5376,5404,0,0
DATA 5403,0,0,5402,6425,6425,5401,5376,5397,5397,48,8,0,0,0,0,0,0,29,0
DATA 29,5404,7168,5376,5403,27,21,6682,6656,0,5401,21,25,5376,0,5376,48,8,0,0
DATA 0,0,0,0,29,0,0,5404,0,0,5403,0,0,5402,0,0,6425,6425,25,5376
DATA 5397,5397,48,8,0,0,0,0,0,0,29,0,29,7196,7168,5404,5403,27,5403,5402
DATA 5376,5402,5401,0,5401,5376,0,5376,48,8,0,0,0,0,0,0,29,0,29,7196
DATA 0,5404,5403,27,5403,5402,6656,5402,5401,0,5401,5376,0,5376,48,8,0,0,0,0
DATA 0,0,7453,7453,29,5404,5397,5404,5403,0,5403,5402,0,5402,6425,6425,5401,5376,5397,5397
DATA 48,8,0,0,0,0,0,0,7453,7453,29,5404,5397,5404,5403,0,5403,6682,6682,5402
DATA 5401,5397,5397,5376,0,0,48,8,0,0,0,0,0,0,7453,7453,29,5404,5397,5404
DATA 5403,27,5403,5402,6656,5376,6425,25,25,5376,5397,5376,48,8,0,0,0,0,0,0
DATA 7453,7453,29,5404,5397,5404,5403,0,5403,5402,6682,5376,5401,6400,25,5376,0,5397,48,8
DATA 0,0,0,0,0,0,7453,7453,29,5404,5397,5397,6939,6939,27,5376,5397,5402,6425,6425
DATA 5401,5376,5397,5397,48,8,0,0,0,0,0,0,7453,7453,29,5376,5404,5397,0,5403
DATA 0,0,5402,0,0,5401,0,0,5376,0,48,8,0,0,0,0,0,0,29,0
DATA 29,5404,0,5404,5403,0,5403,5402,0,5402,6425,6425,5401,5376,5397,5397,48,8,0,0
DATA 0,0,0,0,29,0,29,5404,7168,5376,5403,27,21,6682,5376,0,5401,21,0,5376
DATA 0,0,48,8,0,0,0,0,0,0,29,0,29,5404,28,5404,5403,5403,5403,6682
DATA 6682,5376,5401,5401,21,5376,5376,0,48,8,0,0,0,0,0,0,29,0,29,7168
DATA 7168,5376,0,27,21,6656,6656,0,25,21,25,5376,0,5376,48,8,0,0,0,0
DATA 0,0,29,0,29,7168,7168,5376,0,27,21,0,5402,0,0,5401,0,0,5376,0
DATA 48,8,0,0,0,0,0,0,7453,7453,29,5376,7189,5397,0,27,21,6656,5376,0
DATA 6425,6425,25,5376,5397,5397,56,8,0,7936,7967,0,7680,5376,5397,0,5405,0,7168,28
DATA 21,0,5376,27,0,0,6656,21,0,0,6400,6425,0,0,5376,5397,24,8,7967,7680
DATA 5406,7453,21,5397,6939,6656,5402,6425,21,5397,56,8,7967,31,0,0,5397,30,0,0
DATA 7424,21,0,0,7168,28,0,6912,5376,21,0,5402,0,6425,25,21,0,5397,21,0
DATA 64,8,0,31,0,31,7680,7680,7680,5376,29,21,29,21,5376,0,5376,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,72,8,7967,7967,0,7936
DATA 0,5406,7710,7680,5406,7424,7445,7445,7424,21,5404,5404,5376,5404,0,21,21,0,21,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0

HERODATA: 'Data for outr Sprite
DATA 2080
DATA 128,16,0,0,0,0,0,0,0,0,0,0,4096,4096,16,16,0,0,0,0
DATA 4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4122,4112,4112
DATA 0,0,0,0,4112,6672,-17648,4112,0,0,0,0,-17648,6847,-17648,4287,0,0,0,0
DATA 4112,6672,4283,4112,0,0,0,4112,3856,-17648,4287,4111,0,0,4096,-16453,4165,-17477,-16449,19216
DATA 4112,0,11536,4287,17733,4112,4112,4171,-16453,16,-17648,16,4112,18504,19272,4112,-16449,16,4096,16
DATA -10224,4112,4112,4312,4112,0,0,0,-10224,-9000,-10020,4312,0,0,0,0,4096,7896,4316,16
DATA 0,0,0,0,4096,7707,4126,0,0,0,128,16,0,0,4096,4096,16,16,0,0
DATA 0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4122
DATA 4112,4112,0,0,0,0,4112,6672,-17648,4112,0,0,0,0,-17648,6847,-17648,4287,0,0
DATA 0,0,4112,6672,4283,4112,0,0,0,0,3856,-17648,4287,4111,0,0,0,4096,4165,-16453
DATA -16449,19216,16,0,0,4112,17733,4112,4112,19275,4112,0,0,-17648,17680,17736,18504,4171,4283,0
DATA 4096,11707,4112,18501,19272,4112,-16453,16,4096,-16453,-10224,4112,4112,4316,-16453,16,0,4112,-10224,-8996
DATA -9000,4316,4112,0,0,0,-10224,-9186,7896,4316,0,0,0,0,6928,7710,7707,4126,0,0
DATA 128,16,0,0,0,0,0,0,0,0,0,0,4096,4096,16,16,0,0,0,0
DATA 4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4122,4112,4112
DATA 0,0,0,0,4112,6672,-17648,4112,0,0,0,0,-17648,6847,-17648,4287,0,0,0,0
DATA 4112,6672,4283,4112,0,0,0,4096,3856,-17648,4287,4111,4112,0,0,4112,4165,-16453,-16449,19216
DATA -16453,16,4096,-17473,17680,4112,4112,19275,-17648,4287,4096,-16449,4112,18504,19272,4112,4096,4283,0,4112
DATA -10224,4112,4112,4316,4096,16,0,0,-10224,-10024,-8996,4316,0,0,0,0,4096,-10224,-9186,16
DATA 0,0,0,0,0,6928,7710,16,0,0,128,16,0,0,4096,4096,16,16,0,0
DATA 0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4122
DATA 4112,4112,0,0,0,0,4112,6672,-17648,4112,0,0,0,0,-17648,6847,-17648,4287,0,0
DATA 0,0,4112,6672,4283,4112,0,0,0,0,3856,-17648,4287,4111,0,0,0,4096,4165,-16453
DATA -16449,19216,16,0,0,4112,17733,4112,4112,19275,4112,0,0,-17648,17680,17736,18504,4171,4283,0
DATA 4096,11707,4112,18501,19272,4112,-16453,16,4096,-16453,-10224,4112,4112,4316,-16453,16,0,4112,-10224,-8996
DATA -9000,4316,4112,0,0,0,-10224,-9186,7896,4316,0,0,0,0,6928,7710,7707,4126,0,0
DATA 128,16,0,0,0,0,0,0,0,0,0,0,4096,4112,4096,0,0,0,0,0
DATA 4112,4112,4112,16,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112
DATA 0,0,0,0,4112,4112,4112,4112,0,0,0,4096,4122,-16453,4112,4112,4096,0,0,6672
DATA -17648,4112,4283,4112,7696,16,0,26,-17648,3856,-16453,4112,4112,0,0,0,-17648,-16449,4287,-17589
DATA 4287,0,0,4096,4112,4112,19216,4168,-16453,16,0,4096,4283,18501,18501,16,-17648,16,0,4096
DATA 4283,17733,-9144,16,4112,0,0,0,-10224,-10020,-8996,4316,0,0,0,0,-10224,4316,-9000,7900
DATA 16,0,0,4096,7707,7710,6928,4126,0,0,128,16,0,0,4096,4112,4096,0,0,0
DATA 0,0,4112,4112,4112,16,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112
DATA 4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,4096,4122,-16453,4112,4112,0,0
DATA 0,6672,-17648,4112,4283,4112,16,0,0,26,-17648,3856,-16453,4112,16,0,0,0,-17648,-16449
DATA 4287,4171,4126,0,0,0,4096,4112,18448,4171,16,0,0,0,4096,17733,-17592,4287,0,0
DATA 0,0,4096,4165,-17648,4112,0,0,0,0,4096,-17648,-16449,16,0,0,0,0,4096,-17648
DATA 4287,16,0,0,0,0,4096,4312,4112,4316,0,0,0,0,6928,6928,7710,4126,0,0
DATA 128,16,0,0,0,0,0,0,0,0,0,0,4096,4112,4096,0,0,0,0,0
DATA 4112,4112,4112,16,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112
DATA 0,0,0,0,4112,4112,4112,4112,0,0,0,4096,4122,-16453,4112,4112,4096,0,0,6672
DATA -17648,4112,4283,4112,7696,16,0,26,-17648,3856,-16453,4112,16,0,0,0,-17648,-16449,4287,-17589
DATA 4283,0,0,4096,4112,4112,18448,4168,10939,16,0,4096,-16453,17680,18504,16,-17648,16,0,4096
DATA -16453,-16449,17680,16,4112,0,0,0,4112,4112,-10171,4316,0,0,0,0,-10224,-8996,4316,7896
DATA 16,0,0,4096,7707,7710,6928,4126,0,0,128,16,0,0,4096,4112,4096,0,0,0
DATA 0,0,4112,4112,4112,16,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112
DATA 4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,4096,4122,-16453,4112,4112,0,0
DATA 0,6672,-17648,4112,4283,4112,16,0,0,26,-17648,3856,-16453,4112,16,0,0,0,-17648,-16449
DATA 4287,4171,4126,0,0,0,4096,4112,18448,4171,16,0,0,0,4096,17733,-17592,4287,0,0
DATA 0,0,4096,4165,-17648,4112,0,0,0,0,4096,-17648,-16449,16,0,0,0,0,4096,-17648
DATA 4287,16,0,0,0,0,4096,4312,4112,4316,0,0,0,0,6928,6928,7710,4126,0,0
DATA 128,16,0,0,0,0,0,0,0,0,0,0,0,4112,16,16,0,0,0,0
DATA 4096,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112
DATA 0,0,0,0,4112,4112,4112,4112,0,0,0,16,4112,4112,-16453,6672,16,0,4096,4126
DATA 4112,-17648,4112,4283,4122,0,0,4096,4112,-16453,4111,4283,6656,0,0,-17648,17855,-17648,-16449,4287
DATA 0,0,4096,-16598,17680,4165,4112,4112,16,0,4096,4283,4096,18501,18504,-17648,16,0,0,4112
DATA 4096,17880,19272,-17648,16,0,0,0,-10224,-8996,-8996,4316,0,0,0,4096,-9189,-8996,-10224,4316
DATA 0,0,0,0,7696,4126,7707,7710,16,0,128,16,0,0,0,4112,16,16,0,0
DATA 0,0,4096,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112
DATA 4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,-16453,6672,16,0
DATA 0,4096,4112,-17648,4112,4283,4122,0,0,4096,4112,-16453,4111,4283,6656,0,0,7696,17680,-17648
DATA -16449,4287,0,0,0,4096,17680,4165,4112,16,0,0,0,0,-17648,18623,19272,16,0,0
DATA 0,0,4112,4283,19216,16,0,0,0,0,4096,10939,4287,16,0,0,0,0,4096,-17648
DATA 4287,16,0,0,0,0,-9200,4112,-9200,16,0,0,0,0,6928,7710,4126,4123,0,0
DATA 128,16,0,0,0,0,0,0,0,0,0,0,0,4112,16,16,0,0,0,0
DATA 4096,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112
DATA 0,0,0,0,4112,4112,4112,4112,0,0,0,16,4112,4112,-16449,6672,16,0,4096,4111
DATA 4112,-16624,4112,4287,4122,0,0,4096,4112,-16449,4111,4287,6656,0,0,-17648,17851,-16624,-16449,4287
DATA 0,0,4096,-17477,17680,4165,4112,4112,16,0,4096,4283,4096,18504,4171,-16453,16,0,0,4112
DATA 4096,4165,-16453,-16598,16,0,0,0,-10224,-9000,4112,4112,0,0,0,4096,-9189,-10224,-8996,4316
DATA 0,0,0,0,3856,4111,3867,3855,16,0,128,16,0,0,0,4112,16,16,0,0
DATA 0,0,4096,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112
DATA 4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,-16453,6672,16,0
DATA 0,4096,4112,-17648,4112,4283,4122,0,0,4096,4112,-16453,4111,4283,6656,0,0,7696,17680,-17648
DATA -16449,4287,0,0,0,4096,17680,4165,4112,16,0,0,0,0,-17648,18623,19272,16,0,0
DATA 0,0,4112,4283,19216,16,0,0,0,0,4096,10939,4287,16,0,0,0,0,4096,-17648
DATA 4287,16,0,0,0,0,-9200,4112,-9200,16,0,0,0,0,6928,7710,4126,4123,0,0
DATA 128,16,0,0,0,0,0,0,0,0,0,0,4096,4096,16,16,0,0,0,0
DATA 4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112
DATA 0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0
DATA 4112,4112,4112,4112,0,0,0,4112,4112,4112,4112,4112,0,0,4096,-16453,4165,4112,4112,19216
DATA 4112,0,-17648,4287,4165,4112,4112,4171,-17648,16,-17648,16,17680,7707,19216,4112,-17477,16,4096,16
DATA 4112,4112,4112,4316,4112,0,0,0,-10224,4112,-8996,4316,0,0,0,0,4096,-10224,-8996,16
DATA 0,0,0,0,0,6928,7710,16,0,0,128,16,0,0,4096,4096,16,16,0,0
DATA 0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112
DATA 4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0
DATA 0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,4096,4165,4112
DATA 4112,19216,16,0,0,4112,17733,4112,4112,19275,4112,0,0,-17648,17680,6984,18462,4171,4283,0
DATA 4096,-16453,4112,4165,19216,4112,-16595,16,4096,-16453,-10224,4112,4112,4316,-16453,16,0,4112,-10224,-8996
DATA -9200,4316,4112,0,0,0,-10224,-8996,-9000,4316,0,0,0,0,6928,7710,7707,4126,0,0
DATA 128,16,0,0,0,0,0,0,0,0,0,0,4096,4096,16,16,0,0,0,0
DATA 4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112
DATA 0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0
DATA 4112,4112,4112,4112,0,0,0,4096,4112,4112,4112,4112,4112,0,0,4112,4165,4112,4112,19216
DATA -16453,16,4096,4283,17680,4112,4112,19216,-17648,4141,4096,-17477,4112,4168,7707,4171,4096,4283,0,4112
DATA -10224,4112,4112,4312,4096,16,0,0,-10224,-8996,4112,4312,0,0,0,0,4096,-9000,4316,16
DATA 0,0,0,0,4096,7707,4126,0,0,0,128,16,0,0,4096,4096,16,16,0,0
DATA 0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112
DATA 4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0
DATA 0,0,4112,4112,4112,4112,0,0,0,0,4112,4112,4112,4112,0,0,0,4096,4165,4112
DATA 4112,19216,16,0,0,4112,17733,4112,4112,19275,4112,0,0,-17648,17680,6984,18462,4171,4283,0
DATA 4096,-16453,4112,4165,19216,4112,-16595,16,4096,-16453,-10224,4112,4112,4316,-16453,16,0,4112,-10224,-8996
DATA -9200,4316,4112,0,0,0,-10224,-8996,-9000,4316,0,0,0,0,6928,7710,7707,4126,0,0

TILEDATA: 'L01.PUT image data.
DATA 780
DATA 128,16,18504,19018,18761,18761,18505,19017,19017,18505,18761,18761,18505,18761,18762,18761,18760,18505,18760,18761
DATA 18762,19017,18761,19016,18761,18761,19017,19016,18505,18760,18762,18760,19017,18506,18505,18504,18762,18761,18762,19018
DATA 18504,18760,18760,18762,18761,18761,18505,18762,18760,18761,19017,18505,19017,18506,18761,19017,18506,19017,18761,19016
DATA 18762,19017,19016,18506,18760,18760,18506,18761,18761,19016,19017,19017,18760,19017,18761,18760,18761,19017,18761,19017
DATA 18761,18506,18761,18504,18761,18505,19017,18504,19016,18761,18506,19017,19016,18505,18761,18762,18761,18760,19016,18761
DATA 18504,18505,18761,18761,19016,18505,18504,18760,18762,18762,18762,18761,18505,18762,19016,18760,18762,18506,18505,18761
DATA 19016,18761,18760,19017,18504,18506,18761,18762,18760,18761,128,16,-30326,-30584,-30326,-30583,-30327,-30326,-30327,-30071
DATA -30583,-30072,-30327,-30584,-30327,-30071,-30582,-30327,-30070,-30328,-30328,-30584,-30328,-30071,-30328,-30326,-30583,-30327,-30071,-30070
DATA -30583,-30327,-30583,-30582,-30327,-30583,-30583,-30583,-30327,-30327,-30327,-30583,-30328,-30072,-30583,-30326,-30071,-30327,-30327,-30328
DATA -30327,-30584,-30583,-30584,-30071,-30327,-30327,-30071,-30071,-30583,-30326,-30583,-30327,-30071,-30582,-30326,-30326,-30326,-30328,-30328
DATA -30071,-30583,-30327,-30071,-30327,-30328,-30071,-30328,-30070,-30327,-30070,-30327,-30328,-30071,-30327,-30584,-30583,-30583,-30071,-30583
DATA -30326,-30328,-30327,-30071,-30583,-30584,-30326,-30071,-30071,-30072,-30326,-30071,-30582,-30328,-30583,-30070,-30327,-30326,-30327,-30583
DATA -30071,-30328,-30328,-30328,-30584,-30328,-30327,-30072,-30583,-30070,-30071,-30583,-30327,-30583,-30071,-30326,-30583,-30582,-30071,-30327
DATA 128,16,7708,7708,7705,7708,7198,7708,7198,7708,7196,7708,7193,7196,7196,7196,7196,7196,6939,7196
DATA 7193,6939,6940,6940,6939,7196,6425,6425,6425,6425,6425,6425,6425,6425,7198,7198,7710,7196,7708,6430
DATA 7196,7710,7196,7196,7196,7196,7196,6430,7196,7196,6940,6940,7195,7195,6939,6428,6939,7195,6425,6425
DATA 6425,6425,6425,6425,6425,6425,7196,7198,7710,6430,7198,7196,7198,7198,7196,7196,7196,6430,7196,7196
DATA 7196,7196,7195,6939,7196,6428,6939,6940,6939,6940,6425,6425,6425,6425,6425,6425,6425,6425,7710,7196
DATA 7710,7196,6430,7708,7198,7708,7196,7196,7196,7196,6430,7196,7196,7196,6939,6940,7196,6939,6428,6939
DATA 6940,6940,6425,6425,6425,6425,6425,6425,6425,6425,128,16,7708,7708,7705,7708,7198,7708,7198,7708
DATA 7196,7708,7193,7196,7196,7196,7196,7196,6939,7196,7193,6939,6940,6940,6939,7196,6425,6425,6425,6425
DATA 6425,6425,6425,6425,7198,6430,7710,7196,6428,6430,7196,7710,7196,6428,7196,7196,6428,6430,7196,7196
DATA 6940,6937,7193,7195,6937,6428,6939,7195,6425,6425,6425,6425,6425,6425,6425,6425,7196,7193,6430,6430
DATA 6430,7196,7198,7198,6428,7196,7196,6425,7196,7193,7196,7196,6427,6939,6428,6428,6939,6937,6939,6940
DATA 6425,6425,6425,6425,6425,6425,6425,6425,7710,7196,6430,7196,6430,6428,7198,7708,7196,7196,7193,7193
DATA 6425,6428,7196,7196,6939,6940,7196,6427,6428,6939,6937,6940,6425,6425,6425,6425,6425,6425,6425,6425
DATA 128,16,-31098,-31098,-31098,-31098,-30327,-30327,-30327,-30327,-31097,-31097,-31097,-31097,-30582,-30582,-30582,-30582,-31098,-31098
DATA -31098,-31098,-30327,-30327,-30327,-30327,-30842,-30842,-30842,-30842,-30072,-30072,-30072,-30072,-31098,-31098,-31098,-31098,-30327,-30327
DATA -30327,-30327,-31097,-31097,-31097,-31097,-30582,-30582,-30582,-30582,-31098,-31098,-31098,-31098,-30327,-30327,-30327,-30327,-30842,-30842
DATA -30842,-30842,-30072,-30072,-30072,-30072,-30327,-30327,-30327,-30327,-31098,-31098,-31098,-31098,-30582,-30582,-30582,-30582,-31097,-31097
DATA -31097,-31097,-30327,-30327,-30327,-30327,-31098,-31098,-31098,-31098,-30072,-30072,-30072,-30072,-30842,-30842,-30842,-30842,-30327,-30327
DATA -30327,-30327,-31098,-31098,-31098,-31098,-30582,-30582,-30582,-30582,-31097,-31097,-31097,-31097,-30327,-30327,-30327,-30327,-31098,-31098
DATA -31098,-31098,-30072,-30072,-30072,-30072,-30842,-30842,-30842,-30842,128,16,5896,5896,6168,6168,6168,6424,6425,6425
DATA 5895,6167,6168,6168,6168,6425,6425,1817,7175,6168,6168,6169,6169,6425,6425,1799,7196,6172,6425,6424
DATA 6425,6425,6937,1799,7196,7452,6168,6424,6425,6681,1799,7175,7452,7453,6172,6425,6425,1817,7196,7196
DATA 7196,7453,7453,6425,6425,7175,7196,7196,7452,7453,7453,6429,6937,6919,7196,7196,7453,7453,7710,2078
DATA 1800,7196,7196,7196,7453,7709,7709,2070,5896,7175,7452,7453,7453,7709,2078,2070,5911,7191,7452,7453
DATA 7710,7709,2056,2070,6167,6168,7196,7453,7454,2078,2071,5911,6167,6168,7448,7453,7710,2070,5896,5911
DATA 6168,6168,6424,7709,2078,2056,5911,6168,6168,6168,6425,7449,5910,5896,6167,6168,6168,6425,6424,6425



'Map Data
'I put this in a data statement since its easier to understand that way
' Smile you could put this in a file if you want
'Dimensions : 36*27
'Note: Col(X) #36 and Row(Y) #27 is not used by the Map. They are there for
'Padding purposes and to prevent errors.
BASEMAPDATA:
DATA 06,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,06
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,06,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,06,06,06,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,06,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,04,04,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,04,04,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,02,01,01,01,01,01,01,01,01,01,01,01,04,04,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,02,01,01,01,01,01,01,01,01,01,01,01,04,04,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,02,02,02,02,02,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,02,02,02,02,02,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,02,01,01,01,01,01,03,03,03,03,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,02,01,01,01,01,01,01,03,03,03,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,03,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,03,03,03,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,03,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,05,01,01,01,01,01,01,01,01,01,01,01,01,01,03,03,03,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,05,05,05,05,01,01,01,01,01,01,01,01,01,03,03,03,03,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,05,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01
DATA 05,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,05

REM $STATIC
FUNCTION AF.FastKB STATIC
'Faster replacement for inkey$
'Break codes(Scancode+128) from 215 are ignored.
'returns the scancode for the pressed key
'the list of scancodes can be found at QB's help file.
IF NOT KeyReProg THEN
OUT &H60, &HF3 'Inform keyboard
FOR Delay& = 1 TO 1000: NEXT Delay& 'Just a precaution(Settle)
OUT &H60, 0 'send fast typematic rate
KeyReProg = -1
END IF

Code = INP(&H60)
IF Code > 215 THEN
AF.FastKB = OldCode
ELSE
AF.FastKB = Code
OldCode = Code
END IF

'Memory 40:1A/1C
'What this does is point the head to tail of the key buffer
DEF SEG = &H40 'Clears the pending key buffer
POKE &H1A, PEEK(&H1C) 'Set head pointer to buffer start...
'For the annoying beep :*)

END FUNCTION

SUB AF.LoadPalPp256 (File$) STATIC

'Loads a pp256 palette
'Changes the VGA palette on the fly
'if File$="" the data statement is used

IF File$ = "" OR File$ = " " THEN
FOR n = 0 TO 255
READ C&
B = C& \ 65536: C& = C& - B * 65536
G = C& \ 256: C& = C& - G * 256
R = C&
OUT &H3C8, n
OUT &H3C9, R
OUT &H3C9, G
OUT &H3C9, B
NEXT
ELSE
FR = FREEFILE
IF INSTR(File$, ".") = 0 THEN File$ = LEFT$(File$, 8) + ".Pal"
OPEN File$ FOR BINARY AS #FR
FOR n = 0 TO 255
GET #FR, , C&
B = C& \ 65536: C& = C& - B * 65536
G = C& \ 256: C& = C& - G * 256
R = C&
OUT &H3C8, n
OUT &H3C9, R
OUT &H3C9, G
OUT &H3C9, B
NEXT
CLOSE #FR
END IF

END SUB

SUB AF.Print (Xpos%, Ypos%, Text$, col%)
'Prints the standard 8*8 CGA font
'Paramenters:
'Segment=the Layer to print to
'Xpos,Ypos=the coordinates of the text
'Text$=the string to print
'col= is the color to print(gradient)

X% = Xpos%
Y% = Ypos%
Spacing% = 8
FOR I% = 0 TO LEN(Text$) - 1
X% = X% + Spacing%
Offset% = 8 * ASC(MID$(Text$, I% + 1, 1)) + 14
FOR J% = 0 TO 7
DEF SEG = &HFFA6
Bit% = PEEK(Offset% + J%)
IF Bit% AND 1 THEN PSET (X%, Y% + J%), col% + J%
IF Bit% AND 2 THEN PSET (X% - 1, Y% + J%), col% + J%
IF Bit% AND 4 THEN PSET (X% - 2, Y% + J%), col% + J%
IF Bit% AND 8 THEN PSET (X% - 3, Y% + J%), col% + J%
IF Bit% AND 16 THEN PSET (X% - 4, Y% + J%), col% + J%
IF Bit% AND 32 THEN PSET (X% - 5, Y% + J%), col% + J%
IF Bit% AND 64 THEN PSET (X% - 6, Y% + J%), col% + J%
IF Bit% AND 128 THEN PSET (X% - 7, Y% + J%), col% + J%
NEXT J%
NEXT I%
DEF SEG

END SUB

SUB Engine.DoControls (Finval) STATIC

'Get the contols using a faster keyhandler
'Finval is the value to set if we wanted to go out of the loop

K = AF.FastKB

SELECT CASE K
CASE KEYESC
Finval = TRUE
CASE KEYSPACE
VsyncOn = NOT VsyncOn
CASE KEYENTER
StatBarON = NOT StatBarON
CASE KEYTAB
Hero.Speed = 2
CASE KEYUP
Hero.Direction = DU 'Direction=Up
Hero.Yv = -Hero.Speed 'Add -Yv to go up
Hero.Xv = 0 'Vertical direction so 0
Engine.MovePlayer Hero 'Update Player position
CASE KEYRIGHT
Hero.Direction = DR 'Direction=DOWN
Hero.Xv = Hero.Speed 'Add +XV to go right
Hero.Yv = 0 'Horizontal so 0
Engine.MovePlayer Hero 'Update Player position
CASE KEYDOWN
Hero.Direction = DD 'Ditto
Hero.Yv = Hero.Speed
Hero.Xv = 0
Engine.MovePlayer Hero
CASE KEYLEFT
Hero.Direction = DL 'Ditto
Hero.Xv = -Hero.Speed
Hero.Yv = 0
Engine.MovePlayer Hero
CASE ELSE
END SELECT

END SUB

SUB Engine.DrawMap STATIC

'Notes:
'1.Mod our Cam with 16 to get correct offset inside the tile
'2.Uses the constants TileH,TileW,ScrnTileXmax,ScrnTileYmax
'3.Constants are declared at the module level

'==========BaseLayer====================
'Formula for X.(the loop below)
'(X*TileW)=Video Screen Coord(0 to 320 Step 16)
'(X*TileW)-Level.Xpos=TileOffset that we have to show from 0 to 16-Xpos
'Assuming Level.Xpos=4
'So if X*TileW=0 then (X*TileW)-Level.Xpos=-4
'We start Drawing from -4 to -4+16
'ie,-4 to 12 then the next tile is 13 to 13+16
'Hope you understand

'Draw our Screen(No need to clear our Page)
'Baselayer
FOR Y = 0 TO ScrnTileYmax
FOR X = 0 TO ScrnTileXmax
Tx = X + Level.TileX
Ty = Y + Level.TileY
IF Tx > MapXmax THEN Tx = MapXmax 'Limit if over the dimensions
IF Ty > MapYmax THEN Ty = MapYmax 'of the map
xtile = Map(Tx, Ty).BaseL 'Get Tilenumber
IF xtile > 0 THEN 'of there is a tile draw it.
ScreenX = (X * TILEW) - Level.Xpos 'Calc where to put a
ScreenY = (Y * TILEH) - Level.Ypos 'particular tile
PUT (ScreenX + TILEW, ScreenY + TILEH), Tile(TileIndex(xtile)), PSET
END IF
NEXT X
NEXT Y

END SUB

SUB Engine.DrawPlayer (Player AS SpriteType) STATIC

'Notes:
'1. Uses the Directional Constants defined at module level(DN,DR...)

'This Stops the Player from Swaying his arms very fast
'DirChanged=Is just a flag to prevent Electric legs effect and to see if
'Player changed direction

IF Player.Direction <> Player.oldDir THEN 'if Player changes direction
Player.DirChanged = 1 'Flag it to change BaseFrame
ELSE
'Delays frame rotation for sprite(Electric legs Smile)
Player.DirChanged = (Player.DirChanged AND 7) + 1 'Try to REM this Smile
END IF

IF Player.DirChanged = 1 THEN
IF Player.Move THEN
Player.Frame = (Player.Frame MOD Player.NumFrame) + 1 'Frame=Current frame(1 to 3) the
'Player sprite is
'Frame is Added to baseFrame to locate
'the True Sprite Offset
'See PP256

SELECT CASE Player.Direction
CASE DR
'Calculate the Frame of the sprite to draw
Player.Frame = Player.Frame + 8 'Base Frame=8
CASE DU
Player.Frame = Player.Frame + 12 'Base Frame=12
CASE DL
Player.Frame = Player.Frame + 4 'Base Frame=4
CASE DD
Player.Frame = Player.Frame 'Base Frame=1
CASE ELSE
END SELECT

Player.Move = FALSE 'Stops the Player from Swaying
'his arms while not moving
ELSE 'if the hero ain't movin'

SELECT CASE Player.Direction
CASE DR
'Calculate the Frame of the sprite to draw
Player.Frame = 8 + 4
CASE DU
Player.Frame = 12 + 4
CASE DL
Player.Frame = 4 + 4
CASE DD
Player.Frame = 4
CASE ELSE
END SELECT

END IF

END IF

'Formula: X(same goes for Y)
'Player.X-Level.CamX
'just puts the player at the Center of screen
'So if Player.X=500 then CamX=Player.X-ScrnYmid(ScrnYmid=Middle of 320=160)
'CamX:500-160=340
'Player.X=500
'Xcenter:500-340=160(ScrnXmid)
'Same goes for Y
'See Engine.UpdateCamera for more Details Smile
'Sprite(SpriteIndex(Sprite.Frame) is the current frame of the Sprite(calculated above)
'Notes:
'1.Sprite(SpriteIndex(Sprite.Frame))=Real offset of the frame(NO ERRORS)
'2.SpriteIndex(Sprite.Frame)=Index of the real offset of the frame(ERRORS)


IF Player.Frame <> 0 THEN 'Just to be sure to prevent errors since PP256 starts at 1
PUT (Player.X - Level.CamX, Player.Y - Level.CamY), HeroMask(HeroMaskIndex(Player.Frame)), AND
PUT (Player.X - Level.CamX, Player.Y - Level.CamY), HeroSpr(HeroSprIndex(Player.Frame)), OR
END IF

Player.oldDir = Player.Direction 'Save our Direction for checking above
'OldDir is saved since we have declared
'this SUB as STATIC

END SUB

SUB Engine.DrawScreen STATIC
'Draw our map and player to screen

Engine.DrawMap 'Draw our map to Vpage()
Engine.DrawPlayer Hero 'Draw our Player to Vpage()

'Erase the ugly borders
LINE (0, 0)-(319, 15), 0, BF 'top
LINE (0, 0)-(15, 199), 0, BF 'left
LINE (304, 0)-(319, 199), 0, BF 'right
LINE (0, 176)-(319, 199), 0, BF 'bottom


IF StatBarON THEN 'Draw Statusbar of on
Engine.DrawStatBar
END IF

IF VsyncOn THEN 'doh?!
END IF



END SUB

SUB Engine.DrawStatBar
STATIC FPS, FPS2, StartTime&

'Calc FPS
FPS = FPS + 1
IF StartTime& + 1 < TIMER THEN
FPS2 = FPS
FPS = 0
StartTime& = TIMER
END IF

'Note: This slows things dowm ;*(
AF.Print 0, 176, "FPS:" + STR$(FPS2), 23
'AF.Print 0, 176 + 8, "Whoooaaaa!!!!! No LIBS?!!!!!", 152
'AF.Print 0, 176 + 16, "Relsoft/Plasma357/L_O_J", 245


END SUB

SUB Engine.InitHero (NewObject AS SpriteType)

'Initializes the hero's attributes(characteristics)

NewObject.id = 1
NewObject.X = 18 * TILEW 'Start from 18 tiles right
NewObject.Y = 15 * TILEH '15 tiles down
NewObject.oldX = 18 * TILEW
NewObject.oldY = 15 * TILEH
NewObject.Xv = 0
NewObject.Yv = 0
NewObject.Active = TRUE
NewObject.Frame = 1
NewObject.MinFrame = 1 'Looking down
NewObject.NumFrame = 4 'number of frames per face
NewObject.Move = TRUE
NewObject.Counter = 0
NewObject.Direction = DD
NewObject.TileX = NewObject.X \ TILEW 'Calculate TileX
NewObject.TileY = NewObject.Y \ TILEH
NewObject.Collide = FALSE
NewObject.Speed = 1 'Set speed to 1

END SUB

SUB Engine.InitLevel

Level.Xmax = MapXmax 'Load max values
Level.Ymax = MapYmax
Level.CamX = 0
Level.CamY = 0
Level.TileX = 0
Level.TileY = 0
Level.Xpos = 0
Level.Ypos = 0

END SUB

SUB Engine.InitVars
VsyncOn = TRUE 'WAIT ON
StatBarON = TRUE 'Status bar ON
END SUB

SUB Engine.LoadDATA

'Load data from DATA statements

RESTORE FJPALDATA 'Set up Pal
AF.LoadPalPp256 ""

RESTORE HERODATA 'Read PP256's documentation
InitImageData "", HeroSpr()
MakeImageIndex HeroSpr(), HeroSprIndex()

GenMask HeroSpr(), HeroSprIndex(), HeroMask(), HeroMaskIndex()

RESTORE TILEDATA
InitImageData "", Tile()
MakeImageIndex Tile(), TileIndex()


RESTORE FONTDATA
InitImageData "", Font()
MakeImageIndex Font(), FontIndex()

END SUB

SUB Engine.LoadMap STATIC

RESTORE BASEMAPDATA 'Read from Data label BASEmapDATA

FOR Y = 0 TO MapYmax
FOR X = 0 TO MapXmax
READ Tile
Map(X, Y).BaseL = Tile 'If you don't understand this.....
NEXT X
NEXT Y

END SUB

SUB Engine.Main STATIC

Finished = FALSE 'For our loop

DO
Engine.UpdateCamera Level, Hero 'Update camera position
SetVideoSeg Layer 'Set Draw to Buffer
Engine.DrawScreen 'Draw Our Screen to page and
SetVideoSeg &HA000 'Set Draw to screen
PUT (0, 0), Vpage(6), PSET
'Copy it to VIDEO
Engine.DoControls Finished 'Control the player

LOOP UNTIL Finished

END SUB

SUB Engine.MovePlayer (Player AS SpriteType) STATIC

'Updates the players position according to its direction
'ZELDA style Pixel*Pixel free movement
'Sample Code:
'CODE: Player.X = Player.X + Player.XV
'Add Xspeed to Player X position
'(-)=LEFT, (+)=Right
'Same for Y
'CODE: IF Player.X > (Level.Xmax * TileW) THEN Player.X = (Level.Xmax * TileW)
'Checks if player is outside of World map boudaries
'(Level.Xmax * TileW) - TileW=(36*16)-16

'Save old player values as this is used for "Snapping" back to
'its original position if we collided with a tile.

Player.oldX = Player.X
Player.oldY = Player.Y


'***Move the player Horizontaly
'***and limit the position if its out of bounds
Player.X = Player.X + Player.Xv
IF Player.X < TILEW THEN Player.X = TILEW
IF Player.X > (Level.Xmax * TILEW) + TILEW THEN Player.X = (Level.Xmax * TILEW) + TILEW

'***Move the player vertically
'***and limit the position if its out of bounds
Player.Y = Player.Y + Player.Yv
IF Player.Y < TILEH THEN Player.Y = TILEH
IF Player.Y > (Level.Ymax * TILEH) + TILEH THEN Player.Y = (Level.Ymax * TILEH) + TILEH

'Update the player moveFlag to animate the player(REM this for no Animation)
Player.Move = TRUE

'Return Player last pos if collided with collidable tiles
IF Engine.TileCollide(Player) THEN
Player.X = Player.oldX
Player.Y = Player.oldY
END IF

'Calculate what Tile the player is
'Add 8 to X and Y to get center of Player since size is 16*16
Player.TileX = (Player.X + 8) \ TILEW 'Center of Sprite
Player.TileY = (Player.Y + 8) \ TILEH

END SUB

FUNCTION Engine.TileCollide (Player AS SpriteType) STATIC
'Crappy tile*tile collision detection Wink
'Returns TRUE if collision is detected, FALSE if not

'Init the function to be FALSE(no collision)
Engine.TileCollide = FALSE
px = Player.X - TILEW 'Ruler postulate ;*)
py = Player.Y - TILEH


'4 checks are done to be sure Wink
'Up-Left corner of hero
X = px + 10 'Add 1 for 15*15 Box Collision
Y = py + 8
GOSUB CheckForTile 'check for the tile

'Up-Right corner of hero
X = px + 10
Y = py + 8
GOSUB CheckForTile

'Down-Right corner of hero
X = px + 10
Y = py + 15
GOSUB CheckForTile

'Down-Left corner of hero
X = px + 5
Y = py + 15
GOSUB CheckForTile


EXIT FUNCTION

'Check for collisionSadBounding BoxType)
CheckForTile:
Tx = X \ TILEW 'Player.X\TileW=TileX
Ty = Y \ TILEH 'Player.Y\TileH=TileH

'Check the HI and LOW byte of our fringe layer
'0=No collision,else= collision

IF Map(Tx, Ty).BaseL > 1 THEN
Engine.TileCollide = TRUE
EXIT FUNCTION
END IF

RETURN 'Check for next Coord


END FUNCTION

SUB Engine.UpdateCamera (Level AS LevelType, Player AS SpriteType) STATIC

'Updates CAMX,CAMY in relation to Player.X,Player.Y to achieve
'ZELDA style scrolling engine.
'Sample Code:
'CODE: CASE DR
'Right Direction of movement
'CODE: Level.CamX = Player.X - VMIDx
'Center our player to the screen and Moves the camera to where
'the player is going
'ie, Assume: Player.X=1200,VMIDX=Constant 160(Middle screen)
'Level.CamX:1200-160=1040
'to get the TileX:
'TileX=Level.CamX\TileW=1040\16=65(This will be used with Engine.DrawMap)
'CODE: IF Level.CamX < 0 THEN Level.CamX =0
'Check if level.CamX<0, Zero it if its negative to prevent errors
'ScrnYmin=0(Constant)
'CODE: IF Level.CamX > (Level.Xmax * TileW) - ScrnXmax THEN Level.CamX = (Level.Xmax * TileW) - ScrnXmax
'Check if Level.CamX > (Level.Xmax * TileW) - ScrnXmax
'(Level.Xmax * TileW) - ScrnXmax=Maximum number of PIXELS the Map has
'Level.Xmax=Max num of tile for map(Shared Variable Level.Element)
'TileW=Width of tile(Constant)
'ScrnXmax=320(Constant)
'To calculate: Level.Xmax=MapXmax
'FormulaSadLevel.Xmax * TileW) - ScrnXmax
'Level.Xmax=36
'(36*16)-320=256
'Level.CamX=256
'To calculate TileX:
'Level.CamX\TileW
'256\16=16
'TileX=16(Start Drawing from 16 to 36)
'16 is the first tile to draw in X
'36-16=20(See we have to draw 20 tiles horizontally!!!)
'Same goes for Y
'See Engine.DrawMap SUB for more details. Wink

'*** Update the camera
Level.CamX = Player.X - VMIDx

'***Limit if out of bounds
IF Level.CamX < 0 THEN Level.CamX = 0
IF Level.CamX > ((Level.Xmax + 1) * TILEW) - VWID THEN Level.CamX = ((Level.Xmax + 1) * TILEW) - VWID

Level.CamY = Player.Y - VMIDy

IF Level.CamY < 0 THEN Level.CamY = 0
IF Level.CamY > ((Level.Ymax + 1) * TILEH) - VHEI THEN Level.CamY = ((Level.Ymax + 1) * TILEH) - VHEI

'Calculate the first tile to draw
Level.TileX = Level.CamX \ TILEW 'First tile to draw
Level.TileY = Level.CamY \ TILEH

'Get the offset inside the tile use AND if its a pow of 2 tilesize
Level.Xpos = Level.CamX MOD TILEW 'Position in the Tile(0 to 15)
Level.Ypos = Level.CamY MOD TILEH '16*16 tile size(change to fit your needs)


END SUB

SUB GenMask (Array(), ArrayIndex(), Mask(), MaskIndex())
'Creats masks for our sprites as we ain't using a LIB
'so we have to make use od masks for transparency

REDIM Mask(1 TO UBOUND(Array))
REDIM MaskIndex(1 TO UBOUND(ArrayIndex))

FOR I = 1 TO UBOUND(Array) 'Recopy values
Mask(I) = Array(I)
NEXT I
FOR I = 1 TO UBOUND(ArrayIndex) 'ditto
MaskIndex(I) = ArrayIndex(I)
NEXT I

FOR I = 1 TO UBOUND(ArrayIndex) 'mask em. ;*)
W% = Array(ArrayIndex(I)) \ 8
H% = Array(ArrayIndex(I) + 1)
foo& = 0
FOR Y = 0 TO H% - 1
FOR X = 0 TO W% - 1
DEF SEG = VARSEG(Array(1))
C% = PEEK(VARPTR(Array(ArrayIndex(I) + 2)) + foo&)
IF C <> 0 THEN
DEF SEG = VARSEG(Mask(1))
POKE VARPTR(Mask(MaskIndex(I) + 2)) + foo&, 0
ELSE
DEF SEG = VARSEG(Mask(1))
POKE VARPTR(Mask(MaskIndex(I) + 2)) + foo&, 255
END IF
foo& = foo& + 1
NEXT X
NEXT Y

NEXT I
DEF SEG

END SUB

SUB InitImageData (FileName$, ImageArray())

IF FileName$ <> "" THEN
'***** Read image data from file *****

'Establish size of integer array required.
FileNo = FREEFILE
OPEN FileName$ FOR BINARY AS #FileNo
Ints = (LOF(FileNo) - 7) \ 2
CLOSE #FileNo
REDIM ImageArray(1 TO Ints)

'Load image data directly into array memory.
DEF SEG = VARSEG(ImageArray(1))
BLOAD FileName$, 0
DEF SEG
ELSE
'***** Read image data from DATA statements *****

'Establish size of integer array required.
READ IntCount
REDIM ImageArray(1 TO IntCount)

'READ image DATA into array.
FOR n = 1 TO IntCount
READ X
ImageArray(n) = X
NEXT n
END IF

END SUB

SUB MakeImageIndex (ImageArray(), IndexArray())

'The index will initially be built in a temporary array, allowing
'for the maximum 1000 images per file.
DIM Temp(1 TO 1000)
ptr& = 1: IndexNo = 1: LastInt = UBOUND(ImageArray)
DO
Temp(IndexNo) = ptr&
IndexNo = IndexNo + 1

'Evaluate descriptor of currently referenced image to
'calculate the beginning of the next image.
X& = (ImageArray(ptr&) \ 8) * (ImageArray(ptr& + 1)) + 4
IF X& MOD 2 THEN X& = X& + 1
ptr& = ptr& + (X& \ 2)
LOOP WHILE ptr& < LastInt

LastImage = IndexNo - 1

'Copy the image index values into the actual index array.
REDIM IndexArray(1 TO LastImage)
FOR n = 1 TO LastImage
IndexArray(n) = Temp(n)
NEXT n
ERASE Temp
END SUB

SUB SetVideoSeg (Segment) STATIC

DEF SEG

IF VideoAddrOff& = 0 THEN ' First time the sub is called

' We need to find the location of b$AddrC, which holds the graphics
' offset (b$OffC) and segment (b$SegC). Since b$AddrC is in the default
' segment, we can find it by setting it to a certain value, and then
' searching for that value.

SCREEN 13 ' Set b$SegC to A000 (00A0 in memory)
PSET (160, 100), 0 ' Set b$OffC to 7DA0 (not needed in the IDE)

FOR Offset& = 0 TO 32764 ' Search for b$AddrC, which is
IF PEEK(Offset&) = &HA0 THEN ' in the default segment and
IF PEEK(Offset& + 1) = &H7D THEN ' should have a value of
IF PEEK(Offset& + 2) = &H0 THEN ' A0 7D 00 A0.
IF PEEK(Offset& + 3) = &HA0 THEN
VideoAddrOff& = Offset& + 2 ' If we found it, record the
EXIT FOR ' offset of b$SegC and quit
END IF ' looking. (Oddly, changing
END IF ' the b$OffC doesn't seem to
END IF ' do anything, so this is why
END IF ' this sub only changes b$SegC)
NEXT

END IF

' Change b$SegC to the specified Segment

POKE VideoAddrOff&, Segment AND &HFF
POKE VideoAddrOff& + 1, (Segment AND &HFF00&) \ &H100


END
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#2
Cool. Perfect for us "too-silly-too-lazy-too-use-libs-dudes" :wink:
[Image: jocke.gif]
Website: http://jocke.phatcode.net
"Some men get the world, other men get ex hookers and a trip to Arizona."
Reply
#3
Awww, the scrolling's all glitchy Cry
am an asshole. Get used to it.
Reply
#4
glitchy? works fine for me, even in xp.

Nice job Rel 8)
Reply
#5
not bad. but i have been searching the net for pixel scrollers for a long time (no libs or asm) and i found quite a few. here's the link to them. note they're only pixel scrollers. they can all be run from the zip file except the clipping version of scroll (it is one of the few that uses tiles like grass or trees and such.)

http://www.rpg-dev.net/pixel_scroll.zip

oh, and btw, i added the zelda-type scroller to it as well. thanks Rel!

Ninkazu, are you talking about the slowdown after holding down an arrow key? That's because of inp(96). it's common enough with pixel scrollers. you can fix it by putting in inkey$, or by making a keyboard handler. 1pscrll2 has a multi-key input. there's no slowdown, and you can use multi-keys! doesn't work as well as one would like though, as the arrow keys stick. to use properly, use the numpad.

so far i've got 10 pixel scrollers in the archive. Hoping to find more. if anyone finds a pure qb pixel scroller on the HD, then please email it to me so i can put it in the archive for us lazy coders (i sound like an ad Tongue)
Jumping Jahoolipers!
Reply
#6
BTW, it would run faster if you REM that stupid AF.lPrint. ;*)

Barock: Try Lithium's LPScroll. The fastest TileBased scroller w/o setvideoseg. ;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#7
i'm looking for it...

i couldn't find it. Cry

oh well. how fast does it run rel? the fastest one in my archive is 150 fps on a 1.8 ghz processor... but it's also supremely slowed down with spyware and adware and stuff. i've hit 180 fps before on a much much slower comp but it didn't have all of that spyware stuff. think you can point me to the link if it's still up? or maybe just paste the source code.

btw, the code for the scroller is a bit big, don't you think? over 50 kilobytes in txt form? ouch. the 180 fps one is not even 10 kilobytes.

and here's one i found on the m/k website. it uses mode x, something i don't know anything about :-? but it runs very fast (attempts to clock it didn't work. Guess it's too high tech... lol.)

>EDIT<

Found it! :bounce: (lpscroll) wow, it's fast!
Jumping Jahoolipers!
Reply
#8
Heh, the scroller I posted runs at 250 FPS on a cyrix 233. Try REMMING the Wait &h3da,8 there to see if it is still playable. ;*)
BTW, Compile it to see more speed.



I duno what would be faster though, this scroller or lith's but last time I checked lith's on a 486 and it ran at 30 FPS compiled. Didn't check this scroller though. ;*)

The bulk of the file are Comments and data statements. ;*)

As I said Try to rem the line with Wait &h3da,8 to see if you can still play it. ;*)

PS. ModeX would be much slower than chained 13h.
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#9
maybe. i don't know anything about mode x.

okay, here's some times:

1pscrll2: 115 fps
the zelda-type scroller: 55-60 fps
lith scroll: 130 fps
ppscroll: 150-160 fps
clip3: 125 fps

therefore lithium's scroller is the second fastest i've ever seen: in pure qb of course.

>EDIT<

I downloaded it in a package... wow... the real impressive stuff was in the package it came in. Lithium sure knows his qb.
Jumping Jahoolipers!
Reply
#10
Quote:maybe. i don't know anything about mode x.

okay, here's some times:

1pscrll2: 115 fps
the zelda-type scroller: 55-60 fps
lith scroll: 130 fps
ppscroll: 150-160 fps
clip3: 125 fps

therefore lithium's scroller is the second fastest i've ever seen: in pure qb of course.

>EDIT<

I downloaded it in a package... wow... the real impressive stuff was in the package it came in. Lithium sure knows his qb.

As I said, the zelda scroller won't go over the 60 FPS limit as it has to Wait for Vsynch.

Try on the QB Ide...

1. Find "Wait &h3da,8"
2. Erase the darn code
3. Run the engine again and see the FPS increase. ;*)

you won't believe your eyes. ;*)

PS. That zelda scroller is as pureQB as it can get. ;*)

BTW, I already removed the Wait command. Try to recopy the code above and report how much FPS are you getting. ;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)