2011-08-20 17:49:22 +02:00
|
|
|
; This file holds all the functions If it gets too big,
|
|
|
|
; we can split it in categories
|
|
|
|
|
|
|
|
; *****************************************************************************
|
|
|
|
; * Tileset
|
2011-08-20 20:14:22 +02:00
|
|
|
Procedure InitGraphics()
|
|
|
|
GFXLogo = LoadSprite(#PB_Any, "../data/gfx/logo.bmp")
|
2011-08-20 21:43:17 +02:00
|
|
|
GFXTileset = LoadSprite(#PB_Any, "../data/gfx/tileset01.bmp")
|
2011-08-20 20:14:22 +02:00
|
|
|
EndProcedure
|
|
|
|
|
2011-08-20 22:37:31 +02:00
|
|
|
; TODO: Make this dynamic
|
2011-08-20 17:49:22 +02:00
|
|
|
Procedure InitTileset()
|
2011-08-20 21:43:17 +02:00
|
|
|
Tileset(0) = CopySprite(GFXTileset, #PB_Any)
|
2011-08-20 22:37:31 +02:00
|
|
|
ClipSprite(Tileset(0), #TILE_SIZE*0, 0, #TILE_SIZE, #TILE_SIZE)
|
2011-08-20 21:43:17 +02:00
|
|
|
|
|
|
|
Tileset(1) = CopySprite(GFXTileset, #PB_Any)
|
2011-08-20 22:37:31 +02:00
|
|
|
ClipSprite(Tileset(1), #TILE_SIZE*1, 0, #TILE_SIZE, #TILE_SIZE)
|
2011-08-20 21:43:17 +02:00
|
|
|
|
|
|
|
Tileset(2) = CopySprite(GFXTileset, #PB_Any)
|
2011-08-20 22:37:31 +02:00
|
|
|
ClipSprite(Tileset(2), #TILE_SIZE*2, 0, #TILE_SIZE, #TILE_SIZE)
|
|
|
|
|
|
|
|
Tileset(3) = CopySprite(GFXTileset, #PB_Any)
|
|
|
|
ClipSprite(Tileset(3), #TILE_SIZE*3, 0, #TILE_SIZE, #TILE_SIZE)
|
2011-08-20 17:49:22 +02:00
|
|
|
EndProcedure
|
|
|
|
|
2011-08-20 20:15:44 +02:00
|
|
|
Procedure DrawTile(number.i, x.i, y.i)
|
2011-08-20 22:37:31 +02:00
|
|
|
DisplaySprite(Tileset(number), #TILE_SIZE*x, #TILE_SIZE*y)
|
2011-08-20 20:15:44 +02:00
|
|
|
EndProcedure
|
|
|
|
|
|
|
|
Procedure DrawMap()
|
2011-08-20 22:37:31 +02:00
|
|
|
Define X.i ,Y.i
|
2011-08-20 20:15:44 +02:00
|
|
|
|
2011-08-20 23:51:33 +02:00
|
|
|
For X.i=0 To Cam\Width
|
|
|
|
For Y.i=0 To Cam\Height
|
|
|
|
DrawTile(TileMap(X+Cam\X, Y+Cam\Y)\TileNumber, X, Y)
|
2011-08-20 22:37:31 +02:00
|
|
|
Next
|
|
|
|
Next
|
2011-08-20 20:15:44 +02:00
|
|
|
EndProcedure
|
|
|
|
|
2011-08-20 22:52:29 +02:00
|
|
|
Procedure DrawPlayer()
|
2011-08-20 23:51:33 +02:00
|
|
|
DrawTile(Player\TileNumber, Player\X-Cam\X, Player\Y-Cam\Y)
|
2011-08-20 22:52:29 +02:00
|
|
|
EndProcedure
|
|
|
|
|
2011-08-20 22:37:31 +02:00
|
|
|
Procedure DrawHUD()
|
2011-08-20 21:43:17 +02:00
|
|
|
EndProcedure
|
2011-08-20 17:49:22 +02:00
|
|
|
|
2011-08-20 22:52:29 +02:00
|
|
|
|
2011-08-20 17:49:22 +02:00
|
|
|
; *****************************************************************************
|
|
|
|
; * Menu
|
|
|
|
|
|
|
|
Procedure Menu_GotoCurrent()
|
|
|
|
If *ActiveMenu\Entries()\Selected <> #True
|
2011-08-20 22:37:31 +02:00
|
|
|
FirstElement(*ActiveMenu\Entries())
|
2011-08-20 17:49:22 +02:00
|
|
|
|
|
|
|
ForEach *ActiveMenu\Entries()
|
|
|
|
If *ActiveMenu\Entries()\Selected = #True
|
|
|
|
Break
|
|
|
|
EndIf
|
|
|
|
Next
|
|
|
|
EndIf
|
|
|
|
EndProcedure
|
2011-08-20 20:15:44 +02:00
|
|
|
|
|
|
|
|