Attribute VB_Name = "GameTextures"
'// Programmed by Ervin Louie B. Pe Benito
'// GameTextures.bas
'// Texture initialization and functions
'Option Explicit
Public GfxPath As String
Public Sub AssignMouseTexture()
    'This assigns the mouse texture
    GfxPath = App.Path & "\Graphics\"
    Set Misc(1) = dGetTextureAccess("Mouse1.bmp")
End Sub

Public Function dGetTextureAccess(sGraphic As String) As Direct3DTexture8
    Dim strTemp As String
    strTemp = GfxPath & sGraphic
    Debug.Print strTemp
    
    Set dGetTextureAccess = D3DX.CreateTextureFromFileEx(Dev, GfxPath & sGraphic, _
                D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, _
                D3DPOOL_MANAGED, D3DX_FILTER_POINT, D3DX_FILTER_POINT, _
                Colorkey, ByVal 0, ByVal 0)
    
End Function

Public Sub AssignMainScreenTexture()
    'menu textures
    Set Misc(0) = dGetTextureAccess("blank1.bmp")
    Set Misc(2) = dGetTextureAccess("firstscreen.bmp")
    Set Misc(3) = dGetTextureAccess("logo.bmp")
    Set Misc(4) = dGetTextureAccess("paperscreen.bmp")
    Set Misc(29) = dGetTextureAccess("loadbox.bmp")
    Set Misc(30) = dGetTextureAccess("inputbox.bmp")
    'arrow images
    Set Misc(5) = dGetTextureAccess("arrow1.bmp")
    Set Misc(6) = dGetTextureAccess("arrow2.bmp")
    Set Misc(15) = dGetTextureAccess("arrow3.bmp")
    Set Misc(16) = dGetTextureAccess("arrow4.bmp")
End Sub
Public Sub AssignStageTexture()
    'Frame texture <frame yx>
    Set Misc(7) = dGetTextureAccess("frame00.bmp")
    Set Misc(8) = dGetTextureAccess("frame01.bmp")
    Set Misc(9) = dGetTextureAccess("frame02.bmp")
    Set Misc(10) = dGetTextureAccess("frame10.bmp")
    Set Misc(11) = dGetTextureAccess("frame12.bmp")
    Set Misc(12) = dGetTextureAccess("frame20.bmp")
    Set Misc(13) = dGetTextureAccess("frame21.bmp")
    Set Misc(14) = dGetTextureAccess("frame22.bmp")
    'extra windows textures <win xy>
    Set Misc(17) = dGetTextureAccess("win00.bmp")
    Set Misc(18) = dGetTextureAccess("win10.bmp")
    Set Misc(19) = dGetTextureAccess("win20.bmp")
    Set Misc(20) = dGetTextureAccess("win01.bmp")
    Set Misc(21) = dGetTextureAccess("win11.bmp")
    Set Misc(22) = dGetTextureAccess("win21.bmp")
    Set Misc(23) = dGetTextureAccess("win02.bmp")
    Set Misc(24) = dGetTextureAccess("win12.bmp")
    Set Misc(25) = dGetTextureAccess("win22.bmp")
    Set Misc(26) = dGetTextureAccess("belt.bmp")
    Set Misc(27) = dGetTextureAccess("lifeup.bmp")
    Set Misc(28) = dGetTextureAccess("boxselector.bmp")
    Set Misc(31) = dGetTextureAccess("coinbox.bmp")
    Set Misc(32) = dGetTextureAccess("miss.bmp")
    'in game help graphics
    Set Misc(33) = dGetTextureAccess("arrowkeyup.bmp")
    Set Misc(34) = dGetTextureAccess("arrowkeyright.bmp")
    Set Misc(35) = dGetTextureAccess("arrowkeydown.bmp")
    Set Misc(36) = dGetTextureAccess("arrowkeyleft.bmp")
    Set Misc(37) = dGetTextureAccess("priest1.bmp")
    Set Misc(38) = dGetTextureAccess("church1.bmp")
    Set Misc(39) = dGetTextureAccess("codedinvb.bmp")
    Set Misc(40) = dGetTextureAccess("directx.bmp")
End Sub
Public Sub AssignCharTexture()
    Set Userchar.Sprite(1) = dGetTextureAccess("an1.bmp")
    Set Userchar.Sprite(2) = dGetTextureAccess("an2.bmp")
    Set Userchar.Sprite(3) = dGetTextureAccess("an3.bmp")
    Set Userchar.Sprite(4) = dGetTextureAccess("an4.bmp")
    Set Userchar.Sprite(5) = dGetTextureAccess("an5.bmp")
    Set Userchar.Sprite(6) = dGetTextureAccess("an6.bmp")
    Set Userchar.Sprite(7) = dGetTextureAccess("an7.bmp")
    Set Userchar.Sprite(8) = dGetTextureAccess("an8.bmp")
End Sub
Public Sub AssignTilesTexture()
    Set Tiles(1) = dGetTextureAccess("tile1.bmp")
    Set Tiles(2) = dGetTextureAccess("tile2.bmp")
    Set Tiles(3) = dGetTextureAccess("tile3.bmp")
    Set Tiles(4) = dGetTextureAccess("tile4.bmp")
    Set Tiles(5) = dGetTextureAccess("tile5.bmp")
    Set Tiles(6) = dGetTextureAccess("tile6.bmp")
    Set Tiles(7) = dGetTextureAccess("tile7.bmp")
    Set Tiles(8) = dGetTextureAccess("tile8.bmp")
    Set Tiles(9) = dGetTextureAccess("tile9.bmp")
    Set Tiles(10) = dGetTextureAccess("tile10.bmp")
    Set Tiles(11) = dGetTextureAccess("tile11.bmp")
    Set Tiles(12) = dGetTextureAccess("tile12.bmp")
    'farm graphic
    Set Tiles(13) = dGetTextureAccess("tile13.bmp")
    Set Tiles(14) = dGetTextureAccess("tile14.bmp")
    Set Tiles(15) = dGetTextureAccess("tile15.bmp")
    Set Tiles(16) = dGetTextureAccess("tile16.bmp")
    Set Tiles(17) = dGetTextureAccess("tile17.bmp")
End Sub
Public Sub AssignSceneTexture()
    Set SceneBackground(1) = dGetTextureAccess("fightscreen1.bmp")
    Set SceneBackground(2) = dGetTextureAccess("fightscreen2.bmp")
    Set SceneBackground(3) = dGetTextureAccess("buywin.bmp")
    Set SceneBackground(4) = dGetTextureAccess("marketgraphic1.bmp")
    Set SceneBackground(5) = dGetTextureAccess("savescreen.bmp")
End Sub
Public Sub AssignFightTexture()
    Set UserFightChar.Sprite(1) = dGetTextureAccess("an9.bmp")
    Set UserFightChar.Sprite(2) = dGetTextureAccess("an10.bmp")
    Set UserFightChar.Sprite(3) = dGetTextureAccess("an11.bmp")
    Set UserFightChar.Sprite(4) = dGetTextureAccess("an12.bmp")
    'enemy 1
    Set EnemyChar(0).Sprite(1) = dGetTextureAccess("enemy1.bmp")
    Set EnemyChar(0).Sprite(2) = dGetTextureAccess("enemy2.bmp")
    Set EnemyChar(0).Sprite(3) = dGetTextureAccess("enemy3.bmp")
    Set EnemyChar(0).Sprite(4) = dGetTextureAccess("enemy4.bmp")
    'enemy 2
    Set EnemyChar(1).Sprite(1) = dGetTextureAccess("enemyB1.bmp")
    Set EnemyChar(1).Sprite(2) = dGetTextureAccess("enemyB2.bmp")
    Set EnemyChar(1).Sprite(3) = dGetTextureAccess("enemyB3.bmp")
    Set EnemyChar(1).Sprite(4) = dGetTextureAccess("enemyB4.bmp")
    'enemy 3
    Set EnemyChar(2).Sprite(1) = dGetTextureAccess("enemyC1.bmp")
    Set EnemyChar(2).Sprite(2) = dGetTextureAccess("enemyC2.bmp")
    Set EnemyChar(2).Sprite(3) = dGetTextureAccess("enemyC3.bmp")
    Set EnemyChar(2).Sprite(4) = dGetTextureAccess("enemyC4.bmp")
    'enemy 4
    Set EnemyChar(3).Sprite(1) = dGetTextureAccess("enemyD1.bmp")
    Set EnemyChar(3).Sprite(2) = dGetTextureAccess("enemyD2.bmp")
    Set EnemyChar(3).Sprite(3) = dGetTextureAccess("enemyD3.bmp")
    Set EnemyChar(3).Sprite(4) = dGetTextureAccess("enemyD4.bmp")
    'enemy 5
    Set EnemyChar(4).Sprite(1) = dGetTextureAccess("enemyE1.bmp")
    Set EnemyChar(4).Sprite(2) = dGetTextureAccess("enemyE2.bmp")
    Set EnemyChar(4).Sprite(3) = dGetTextureAccess("enemyE3.bmp")
    Set EnemyChar(4).Sprite(4) = dGetTextureAccess("enemyE4.bmp")
End Sub
Public Sub AssignItemTexture()
    Set GameItem(1).Sprite = dGetTextureAccess("items\guavaleaves.bmp")
    Set GameItem(2).Sprite = dGetTextureAccess("items\rice.bmp")
    Set GameItem(3).Sprite = dGetTextureAccess("items\mango.bmp")
    Set GameItem(4).Sprite = dGetTextureAccess("items\apple.bmp")
    Set GameItem(5).Sprite = dGetTextureAccess("items\banana.bmp")
    Set GameItem(6).Sprite = dGetTextureAccess("items\fish.bmp")
    Set GameItem(7).Sprite = dGetTextureAccess("items\ham.bmp")
    Set GameItem(8).Sprite = dGetTextureAccess("items\herb.bmp")
    Set GameItem(9).Sprite = dGetTextureAccess("items\medicine.bmp")
End Sub
