' ################################################################################################################################################################
' Battle Ship 64 by Cobalt
' ################################################################################################################################################################
' =============================================================================
' CHANGE LOG
' WHEN WHO WHAT
' 11/23/2018 Cobalt David Started (30 mins)
' 11/23/2018 Cobalt David V0.0a inital build (45 mins)
' inital types and diminsions in place
' 11/24/2018 Cobalt David V0.0b build (30 mins)
' added Title screen
' loaded sprite sheet
' 11/27/2018 Cobalt David V0.1a First Run Build (300 mins)
' Added\Finished ship deployment
' added auto deployment for computer opponent
' added yellow selection color for ship placement and shot selection
' started shot taking routine
' added Who goes first test
' (made audio files for posible add-in later)
' (ripped video files for posible add-in later)
' 11/28/2018 Cobalt David V0.1b Build (240 mins)
' Added Hit and Miss images
' added player shot routines
' added ship sunk routines
' added Gameover state
' added Computer shooting routine
' 11/29/2018 Cobalt David V0.1C Build (150 mins)
' fixed Computer Shooting routine, computer can now hit players ships.
' fixed message timing, so its a hit shows before ship sunk message
' set randomize to TIMER
' game level Easy, Computer AI: STUPID(always random shots)
' added graphics loading rountine
' public release
' 11/29/2018 Cobalt David V0.1D Build (10 mins)
' fixed oversight found by Bplus were autoplace doesn't clear board first
' adding extra 'ghost' ships to the layout.
' Added Title bar info.
' 11/30/2018 Cobalt David V0.2A Build (540 mins)
' Added Menu and options
' Added ChangeColor routine
' added fonts
' added instruction page 1
' fixed bug if player pressed Reset with ship selected ship stayed selected as a phantom ship.
' Updated GFX file
' Began networking routines
' first successful log in of clients
' 12/01/2018 Cobalt David V0.5A Build (300 mins)
' Ripped Functions\Subs for network retooling.
' Added Networking types\variables\arrays\consts
' added\fixed host startup and client startup
' added communication decodeing
' added Opponent shot for multiplayer games
' 12/02/2018 Cobalt David V0.7A build (210 mins)
' fixed networking protocol
' fixed minor bugs related to network game communication
' added IP address entry to join network screen
' reconsistuted routines into main BAS file
' First successful LAN game at 19:55 EST
' 07/12/2021 madscijr Prettified code a little, renamed variables with Hungarian notation
' to easily identify which ones are shared, constants, arrays, UDTs, etc.
' Broke something so now when you place a ship, it disappears! DOH!
' =============================================================================
' NOTES:
' fonts:Vecteezy.com/free-fonts.com/Geronimo Font Studios[dafont.com]
' QB64 variable types:
' a$ = string
' i% = integer
' L& = long
' s! = single
' d# = double
' b%% = byte
' -----------------------------------------------------------------------------
' A Short Course in Hungarian Notation
' http://www.imm.dtu.dk/~alan/hungarian.html
' In general, Hungarian notation names a variable with a lower-case prefix
' to identify the class or usage of the variable. There is no such thing as
' standard HN, so the point here is to create a consistent notation system.
' In this class, we'll use the following standards.
' c: signed character <- *** NOT USED IN THIS PROGRAM c SPECIFIES CONSTANTS ***
' uc: unsigned character
' i: integer
' ui: unsigned integer
' si: short integer
' li: long integer
' n: an integer number where the actual size is irrelevant
' f: float
' d: double
' s: string of characters
' sz: string of characters, terminated by a null character
' b: an integer or character being used as a boolean value
' by: single byte
' ct: an integer being used as a counter or tally
' p: pointer to a structure or general void pointer
' pfs: file stream pointer
' pfn: pointer to a function
' px: pointer to a variable of class x, e.g. pi, pf, pli
'
' Other prefixes:
' c: constant
' m: shared (module-level) variable
' st: static variable
' arr: array
' Suffixes:
' {name}_Type: user-defined types (UDTs) end with "_Type"
' =============================================================================
' USER-DEFINED TYPES (UDTs)
Destroyer
As Pos_Hits_Type
Submarine
As Pos_Hits_Type
Type Ship_Board_Offsets_Type
Users
As _Byte ' Clients Connected, 2 max Ready
As _Byte ' Opponent has placed ships X
As _Byte ' Opponents shot X location Y
As _Byte ' Opponents shot Y location
NetWork
As Networking_Type
' =============================================================================
' GLOBAL DECLARATIONS
Dim Shared m_arrBoard
(10, 10, 2) As _Byte ' 1-player layout\OPPONENT shots 2-player shots Dim Shared m_arrFleet
(2) As Ships_Type
' *** IS THIS USED? Dim Shared m_arrShip
(10) As Pos_Hits_Type
' 1-5 player 6-10 OPPONENT Dim Shared m_arrShipName$
(5) ' names of ship types
Const c_CARRIER
= 1, c_BATTLESHIP
= 2, c_DESTROYER
= 3, c_SUBMARINE
= 4, c_PTBOAT
= 5 Const c_HORZ
= 11, c_VERT
= 12 Const c_MIX
= 1, c_TITLE
= 2, c_SHEET
= 3, c_SHIPS
= 4, c_SHOTS
= 5, c_BOARD
= 6, c_PEGS
= 7, c_MENU
= 8, c_LAN
= 9 Const c_PLAYER
= 1, c_OPPONENT
= 2, c_LANCLIENT
= 3 Const c_HIT
= -1, c_MISS
= -2, c_BAD
= 4
' ship yard horzontal offsets
ShipYardOffsetsData:
Data 68,316,68,343,68,367,68,393,66,416
ShipBoardOffsetsData:
Data 57,55,58,57,55,58,56,60,55,58 Data 54,58,56,57,57,55,59,57,58,55
ShipBoardOffsetsRedData:
Data 347,55,347,57,343,58,345,60,343,58 Data 343,58,344,57,345,55,347,57,346,55
ShipNamesData:
Data "Carrier","Battle Ship","Destroyer","Submarine","PT Boat"
On Timer(m_Listen&
, .1) MessageCheck
' timer for Host status.
INIT ' load screens, load data, set randomizer
' Title Screen
' *****************************************************************************
m_GameData.Debug = FALSE
' *****************************************************************************
SetUpGameBoard
MainMenu
' /////////////////////////////////////////////////////////////////////////////
' Game Menu
_Font m_arrFFX
(2), m_arrLayer
(c_MIX
) ExitFlag%% = FALSE
_PutImage , m_arrLayer
(c_MENU
), m_arrLayer
(c_MIX
) If m_GameData.Mode
= c_LAN
Then ChangeColor
_RGB32(248, 48, 64), m_arrLayer
(c_MIX
) ChangeColor
_RGB32(48, 48, 64), m_arrLayer
(c_MIX
) ' BASE COLOR If m_GameData.Mode
<> c_LAN
Then _PrintString (280, 180), "START NETWORK GAME", m_arrLayer
(c_MIX
) _PrintString (280, 180), "STOP NETWORK GAME", m_arrLayer
(c_MIX
) _PrintString (280, 210), "JOIN NETWORK GAME", m_arrLayer
(c_MIX
)
If over%%
Then ' hi-lite option mouse is over ChangeColor
_RGB32(248, 248, 48), m_arrLayer
(c_MIX
) ' Hover color If m_GameData.Mode
<> c_LAN
Then _PrintString (280, 180), "START NETWORK GAME", m_arrLayer
(c_MIX
) _PrintString (280, 180), "STOP NETWORK GAME", m_arrLayer
(c_MIX
) _PrintString (280, 210), "JOIN NETWORK GAME", m_arrLayer
(c_MIX
)
DeployFleet
AutoPlaceShips c_OPPONENT
ClearArea
GamePlay
_Font m_arrFFX
(2), m_arrLayer
(c_MIX
) Case 2 ' start host for network game If m_GameData.Mode
= c_LAN
Then ' close down host and host's client reset game to normal mode
' turn off network listening timer
Close #m_GameData.NetWork.Client
Close #m_GameData.NetWork.Host
m_GameData.Mode = FALSE
'IF m_GameData.Debug THEN OPEN "Debughost.txt" FOR OUTPUT AS #6
CreateNetworkGame
UpDate%% = TRUE
Case 3 ' find network game on server list and join 'IF m_GameData.Debug THEN OPEN "debugclient.txt" FOR OUTPUT AS #6
JoinNetworkGame
' -----------------------------------------------------------------------------
' game is now in network mode
' start game directly
DeployFleet
ClearArea
GamePlay
m_Cancel%% = FALSE ' player hit ESC
Close #m_GameData.NetWork.Client
_Font m_arrFFX
(2), m_arrLayer
(c_MIX
) Case 4 ' instructions! heck its point and click ppl! Instruction
ExitFlag%% = TRUE
' trap mouse button down
UpDate%% = FALSE
If x%
> 280 And x%
< 630 Then ' if mouse is in correct X region If y%
> 150 And y%
< 300 Then ' if mouse is in correct Y region over%% = (y% - 150) \ 30 + 1
over%% = 0
ExitFlag%% = FALSE ' reset flag
ChangeColor &HFFFFFFFF, m_arrLayer(c_MIX)
' ----------------------------------
' /////////////////////////////////////////////////////////////////////////////
If port%
= 0 Then default%
= 1979 Else default%
= port%
Result = HostID&
StartHost = Result
' /////////////////////////////////////////////////////////////////////////////
' catch user connection
' -----------------------------------------------------------------------------
' only if HOST
If m_GameData.Mode
= c_LAN
Then newclient
= _OpenConnection(m_GameData.NetWork.Host
) ' receive any new connection m_GameData.NetWork.Users = m_GameData.NetWork.Users + 1
m_arrUser(m_GameData.NetWork.Users).Id = newclient
' -----------------------------------------------------------------------------
' Listen for communication from Players-
If m_GameData.Mode
= c_LAN
Then ' host game only listens for player 2 If m_GameData.NetWork.Users
= 2 Then ' only listen once hosts has both users Get #m_arrUser
(2).Id
, , m_Message$
If m_GameData.Debug
And m_Message$
<> "" Then Print #6, "REC:" + Str$(m_arrUser
(I%%
).Id
) + ":" + m_Message$
Else ' while player two just listens Get #m_GameData.NetWork.Client
, , m_Message$
If m_GameData.Debug
And m_Message$
<> "" Then Print #6, "REC:" + Str$(m_arrUser
(I%%
).Id
) + ":" + m_Message$
' -----------------------------------------------------------------------------
If m_Message$
<> "" Then ProcessMessage
' /////////////////////////////////////////////////////////////////////////////
Case "[SHP]" ' ship xy and orentation data txt$
= Mid$(m_Message$
, 6, 30) m_arrShip(i%%).Xpos = x%%
m_arrShip(i%%).Ypos = y%%
m_arrShip(i%%).Orent = o%%
PlaceShipOnBoard i%%
m_GameData.NetWork.Ready = TRUE
Case "[SHT]" ' players Shot xy data txt$
= Mid$(m_Message$
, 6, 4) m_GameData.NetWork.X = x%%
m_GameData.NetWork.Y = y%%
Case "[FST]" ' who goes first number chance ' go ahead and use x value for this.
m_GameData.NetWork.X
= Val(Mid$(m_Message$
, 6, 2)) Case "[PKN]" ' who goes first number m_GameData.NetWork.Y
= Val(Mid$(m_Message$
, 6, 2))
' /////////////////////////////////////////////////////////////////////////////
If port%
= 0 Then default%
= 1979 Else default%
= port%
If IPA$
= "0" Then IP$
= ":localhost" Else IP$
= ":" + IPA$
connection&
= _OpenClient(ID$
) ' Attempt to connect to local host as a client Result = connection&
ConnectClient = Result
' /////////////////////////////////////////////////////////////////////////////
If m_GameData.Debug
Then Print #6, "SND:" + Str$(m_arrUser
(2).Id
) + ":" + Str$(m_GameData.Mode
) If m_GameData.Mode
= c_LAN
Then If m_GameData.Debug
Then Print #6, "SND:" + Str$(m_arrUser
(2).Id
) + ":" + m_Message$
Put #m_arrUser
(2).Id
, , m_Message$
If m_GameData.Debug
Then Print #6, "SND:" + Str$(m_GameData.NetWork.Client
) + ":" + m_Message$
Put #m_GameData.NetWork.Client
, , m_Message$
m_Message$ = ""
' /////////////////////////////////////////////////////////////////////////////
Sub AutoPlaceShips
(Who%%
) For i%%
= 1 + A%%
To 5 + A%%
' take each ship starting with Carrier x%%
= Int(Rnd * 10) + 1 ' pick a spot and orentation If CheckShipPos
(x%%
, y%%
, o%%
, i%%
) Then Good%%
= TRUE
' check that it fits and doesn't overlap m_arrShip(i%%).Xpos = x%%
m_arrShip(i%%).Ypos = y%%
m_arrShip(i%%).Orent = o%%
PlaceShipOnBoard (i%%)
' /////////////////////////////////////////////////////////////////////////////
' change text color(value~&) on specified m_arrLayer(id~&)
Sub ChangeColor
(value~&
, id~&
)
' /////////////////////////////////////////////////////////////////////////////
Function CheckShipPos
(xt%%
, yt%%
, ot%%
, tt%%
) ' copy values to local variables
' lets not change a variable by accident
x%% = xt%%
y%% = yt%%
o%% = ot%%
t%% = tt%%
If t%%
> 5 Then w%%
= 2: t%%
= t%%
- 5 Else w%%
= 1 ' >5 OPPONENT ships result%% = TRUE
Select Case t%%
' first check to see if ship will fit on board If o%%
= c_HORZ
And x%%
> 6 Then result%%
= FALSE
If o%%
= c_VERT
And y%%
> 6 Then result%%
= FALSE
If o%%
= c_HORZ
And x%%
> 7 Then result%%
= FALSE
If o%%
= c_VERT
And y%%
> 7 Then result%%
= FALSE
Case c_DESTROYER
, c_SUBMARINE
If o%%
= c_HORZ
And x%%
> 8 Then result%%
= FALSE
If o%%
= c_VERT
And y%%
> 8 Then result%%
= FALSE
If o%%
= c_HORZ
And x%%
> 9 Then result%%
= FALSE
If o%%
= c_VERT
And y%%
> 9 Then result%%
= FALSE
If result%%
Then ' if fit test passed make sure no ships in way If m_arrBoard
(x%%
+ i%%
, y%%
, w%%
) Then result%%
= FALSE: i%%
= 5 If m_arrBoard
(x%%
, y%%
+ i%%
, w%%
) Then result%%
= FALSE: i%%
= 5 If m_arrBoard
(x%%
+ i%%
, y%%
, w%%
) Then result%%
= FALSE: i%%
= 5 If m_arrBoard
(x%%
, y%%
+ i%%
, w%%
) Then result%%
= FALSE: i%%
= 5 Case c_DESTROYER
, c_SUBMARINE
If m_arrBoard
(x%%
+ i%%
, y%%
, w%%
) Then result%%
= FALSE: i%%
= 5 If m_arrBoard
(x%%
, y%%
+ i%%
, w%%
) Then result%%
= FALSE: i%%
= 5 If m_arrBoard
(x%%
+ i%%
, y%%
, w%%
) Then result%%
= FALSE: i%%
= 5 If m_arrBoard
(x%%
, y%%
+ i%%
, w%%
) Then result%%
= FALSE: i%%
= 5 CheckShipPos = result%%
' /////////////////////////////////////////////////////////////////////////////
' check for sunk ship on player
m_GameData.PlayerDead = TRUE
MessageHandler "Opponent Sunk players " + m_arrShipName$(i%%) + " !"
st_arrKnown(i%%) = TRUE
If m_arrShip
(i%%
).sunk
= FALSE
Then m_GameData.PlayerDead
= FALSE
' check for sunk ship on opponent
m_GameData.OpponentDead = TRUE
MessageHandler "Player Sunk Opponents " + m_arrShipName$(i%% - 5) + " !"
st_arrKnown(i%%) = TRUE
If m_arrShip
(i%%
).sunk
= FALSE
Then m_GameData.OpponentDead
= FALSE
If m_GameData.PlayerDead
Or m_GameData.OpponentDead
Then m_GameData.GameOver
= TRUE
' /////////////////////////////////////////////////////////////////////////////
' Clear deploy information area
_Dest m_arrLayer
(c_BOARD
) _Dest m_arrLayer
(c_SHIPS
) _PutImage , m_arrLayer
(c_BOARD
), m_arrLayer
(c_MIX
) _PutImage , m_arrLayer
(c_SHIPS
), m_arrLayer
(c_MIX
)
' /////////////////////////////////////////////////////////////////////////////
' /////////////////////////////////////////////////////////////////////////////
Do: Good%%
= FALSE
' run until an unfired upon area is found If m_arrBoard
(x%%
, y%%
, 1) >= 0 Then Good%%
= TRUE
MessageHandler
"Computer fires at " + Chr$(64 + y%%
) + Str$(x%%
)
Case c_HIT
' Computer hits players ship MessageHandler "Computer Hits!"
CheckShips
Case c_MISS
' Computer missed players ship MessageHandler "Computer Misses"
Case c_BAD
' Computer already fired upon this space ERROR MessageHandler "Computer has been Hitting the juice again, fired an error"
' /////////////////////////////////////////////////////////////////////////////
Sub DisplayShip
(X%
, Y%
, ID%%
, Orentation%%
, LayerD&
) If Orentation%%
= c_HORZ
Then _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (500, 277)-(611, 299) Else _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (592, 165)-(614, 276) If Orentation%%
= c_HORZ
Then _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (500, 303)-(588, 321) Else _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (570, 165)-(589, 253) If Orentation%%
= c_HORZ
Then _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (500, 324)-(570, 341) Else _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (551, 165)-(568, 235) If Orentation%%
= c_HORZ
Then _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (500, 344)-(568, 357) Else _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (534, 165)-(548, 233) If Orentation%%
= c_HORZ
Then _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (500, 360)-(546, 375) Else _PutImage (X%
, Y%
), m_arrLayer
(c_SHEET
), LayerD&
, (516, 165)-(531, 211)
' /////////////////////////////////////////////////////////////////////////////
' start game
WhoIsFirst ' find who gets to shoot first!
If m_GameData.WhoIsUp
= c_PLAYER
Then
' shooting routine PLAYER
' mix layers and display
_PutImage , m_arrLayer
(c_BOARD
), m_arrLayer
(c_MIX
) _PutImage , m_arrLayer
(c_SHIPS
), m_arrLayer
(c_MIX
) _PutImage , m_arrLayer
(c_PEGS
), m_arrLayer
(c_MIX
) _PutImage (0, 0), m_arrLayer
(c_MIX
), m_arrLayer
(0), (0, 0)-(639, 300)
If x%
> 344 And y%
> 54 And x%
< 582 And y%
< 294 Then ' mouse over enemy board ' highlite grid block that mouse is over(grid blocks are 22x22[24x24WL])
hx%% = ((x% - 344) \ 24) + 1: hy%% = ((y% - 54) \ 24) + 1
Line (344 + ((hx%%
- 1) * 24), 54 + ((hy%%
- 1) * 24))-(367 + ((hx%%
- 1) * 24), 77 + ((hy%%
- 1) * 24)), c_YellowSelect~&
, BF
' *****************************************************************************
' debug information
' *****************************************************************************
If m_GameData.GameOver
= FALSE
Then ' Main input loop
ExitFlag%% = TRUE
m_GameData.GameOver = TRUE
' Player shoots
If x%
> 344 And y%
> 54 And x%
< 582 And y%
< 294 Then ' only shoot if player is over shot board. MessageHandler
"Player Fires at: " + Chr$(64 + hy%%
) + Str$(hx%%
) m_Message$ = "[SHT]" + m$
m_Message$ = m_Message$ + m$
SendMessage
'Case HIT%% ' player hit enemy ship
Case c_HIT%%
' player hit enemy ship MessageHandler "Player Hits!"
ShotFired%% = TRUE
CheckShips
'Case MISS%% ' player missed enemy ship
Case c_MISS%%
' player missed enemy ship MessageHandler "Player Misses"
ShotFired%% = TRUE
'Case BAD%% ' player already fired upon this space
Case c_BAD%%
' player already fired upon this space MessageHandler "Space Already Fired at, pick again"
ExitFlag%% = TRUE
m_GameData.GameOver = TRUE
ElseIf m_GameData.WhoIsUp
= c_OPPONENT
Then ' opponents turn to shoot! ' mix layers and display
_PutImage , m_arrLayer
(c_BOARD
), m_arrLayer
(c_MIX
) _PutImage , m_arrLayer
(c_SHIPS
), m_arrLayer
(c_MIX
) _PutImage , m_arrLayer
(c_PEGS
), m_arrLayer
(c_MIX
) _PutImage (0, 0), m_arrLayer
(c_MIX
), m_arrLayer
(0), (0, 0)-(639, 300)
If m_GameData.Mode
Then OpponentShot
Else ComputerShot
If m_GameData.GameOver
Then ExitFlag%%
= TRUE
' whos turn is it now?
If m_GameData.WhoIsUp
= c_PLAYER
Then m_GameData.WhoIsUp
= c_OPPONENT
Else m_GameData.WhoIsUp
= c_PLAYER
' dumpboard
If m_GameData.PlayerDead
Then MessageHandler
"You have lost this round." If m_GameData.OpponentDead
Then MessageHandler
"Congratulations You are Victorious!" If Not m_GameData.PlayerDead
And Not m_GameData.OpponentDead
Then MessageHandler
"Game quit..."
MessageHandler "Press any key to return to menu"
' /////////////////////////////////////////////////////////////////////////////
' ID%%-number of the ship, 1-5 player 6-10 opponent
m_arrShip(id%%).Hits = m_arrShip(id%%).Hits + 1
Case c_CARRIER
, c_CARRIER
+ 5 If m_arrShip
(id%%
).Hits
= 5 Then m_arrShip
(id%%
).sunk
= TRUE
Case c_BATTLESHIP
, c_BATTLESHIP
+ 5 If m_arrShip
(id%%
).Hits
= 4 Then m_arrShip
(id%%
).sunk
= TRUE
Case c_DESTROYER
, c_DESTROYER
+ 5 If m_arrShip
(id%%
).Hits
= 3 Then m_arrShip
(id%%
).sunk
= TRUE
Case c_SUBMARINE
, c_SUBMARINE
+ 5 If m_arrShip
(id%%
).Hits
= 3 Then m_arrShip
(id%%
).sunk
= TRUE
Case c_PTBOAT
, c_PTBOAT
+ 5 If m_arrShip
(id%%
).Hits
= 2 Then m_arrShip
(id%%
).sunk
= TRUE
' /////////////////////////////////////////////////////////////////////////////
Get #1, , c~%%
' number of records Get #1, , arrFOffset&
(w%
) arrFOffset&(w%) = arrFOffset&(w%) + 1
m_arrLayer
(c_MIX
) = _NewImage(640, 480, 32) ' composite layer m_arrLayer(c_TITLE) = LoadGFX&(arrFOffset&(1), arrSize(1))
m_arrLayer(c_SHEET) = LoadGFX&(arrFOffset&(2), arrSize(2))
m_arrLayer
(c_SHIPS
) = _NewImage(640, 480, 32) m_arrLayer
(c_SHOTS
) = _NewImage(640, 480, 32) m_arrLayer
(c_BOARD
) = _NewImage(640, 480, 32) m_arrLayer(c_MENU) = LoadGFX&(arrFOffset&(3), arrSize(3))
m_arrLayer(c_LAN) = LoadGFX&(arrFOffset&(4), arrSize(4)) ' _LOADIMAGE("Networking.bmp", 32)
m_arrFFX(1) = LoadFFX&(arrFOffset&(5), arrSize(5), 30) ' _LOADFONT("gunmetl.ttf", 30, "monospace")
m_arrFFX(2) = LoadFFX&(arrFOffset&(6), arrSize(6), 18) ' _LOADFONT("ARGEBL.ttf", 18, "monospace")
m_arrFFX(3) = LoadFFX&(arrFOffset&(7), arrSize(7), 18) ' _LOADFONT("TechnoLCD.ttf", 18, "monospace")
m_arrFFX(4) = LoadFFX&(arrFOffset&(8), arrSize(8), 24) ' _LOADFONT("TechnicznaPomocR.ttf", 24, "monospace")
m_arrFFX(5) = LoadFFX&(arrFOffset&(5), arrSize(5), 48) ' _LOADFONT("gunmetl.ttf", 30, "monospace")
m_arrFFX(6) = LoadFFX&(arrFOffset&(5), arrSize(5), 24) ' _LOADFONT("gunmetl.ttf", 30, "monospace")
ClearLayer c_BOARD
LoadData
' /////////////////////////////////////////////////////////////////////////////
' who%%- which player board to add hit 1-PLAYER, 2-OPPONENT
' put red peg in board and tally hits to ships
Sub ItsAHit
(x%%
, y%%
, Who%%
) HitShip m_arrBoard(x%%, y%%, Who%%) + ((Who%% - 1) * 5)
m_arrBoard(x%%, y%%, Who%%) = c_HIT
' /////////////////////////////////////////////////////////////////////////////
' who%%- which player board to add hit 1-PLAYER, 2-OPPONENT
' put white peg in board
Sub ItsAMiss
(x%%
, y%%
, Who%%
) m_arrBoard(x%%, y%%, Who%%) = c_MISS
' /////////////////////////////////////////////////////////////////////////////
Read m_arrOffs
(i%%
).ShipYard_X
Read m_arrOffs
(i%%
).ShipYard_Y
Read m_arrOffs
(i%%
).Board_HX
Read m_arrOffs
(i%%
).Board_HY
Read m_arrOffs
(i%%
).Board_VX
Read m_arrOffs
(i%%
).Board_VY
Read m_arrOffs
(i%%
).RedBoard_HX
Read m_arrOffs
(i%%
).RedBoard_HY
Read m_arrOffs
(i%%
).RedBoard_VX
Read m_arrOffs
(i%%
).RedBoard_VY
' /////////////////////////////////////////////////////////////////////////////
' /////////////////////////////////////////////////////////////////////////////
Function LoadFFX&
(Foff&
, Size&
, Fize%%
) LoadFFX&
= _LoadFont("temp.dat", Fize%%
, "monospace")
' /////////////////////////////////////////////////////////////////////////////
Sub MessageHandler
(txt$
) ' define message area
' display message
' restore screen area
' /////////////////////////////////////////////////////////////////////////////
' w%%- Which board to place ship 1-player 2-Opponent
' o%%= ships Orentation c_VERT or c_HORZ
' idx%%- Ident of ship to place c_CARRIER to c_PTBOAT
Sub PlaceShipOnBoard
(id%%
) If id%%
<= 5 Then ' players ships w%% = 1: idx%% = id%%
w%% = 2: idx%% = id%% - 5 ' correction for Enemy ships 6-10
o%% = m_arrShip(id%%).Orent
If o%%
= c_HORZ
Then For i%%
= 0 To 4: m_arrBoard
(m_arrShip
(id%%
).Xpos
+ i%%
, m_arrShip
(id%%
).Ypos
, w%%
) = c_CARRIER:
Next i%%
If o%%
= c_VERT
Then For i%%
= 0 To 4: m_arrBoard
(m_arrShip
(id%%
).Xpos
, m_arrShip
(id%%
).Ypos
+ i%%
, w%%
) = c_CARRIER:
Next i%%
If o%%
= c_HORZ
Then For i%%
= 0 To 3: m_arrBoard
(m_arrShip
(id%%
).Xpos
+ i%%
, m_arrShip
(id%%
).Ypos
, w%%
) = c_BATTLESHIP:
Next i%%
If o%%
= c_VERT
Then For i%%
= 0 To 3: m_arrBoard
(m_arrShip
(id%%
).Xpos
, m_arrShip
(id%%
).Ypos
+ i%%
, w%%
) = c_BATTLESHIP:
Next i%%
If o%%
= c_HORZ
Then For i%%
= 0 To 2: m_arrBoard
(m_arrShip
(id%%
).Xpos
+ i%%
, m_arrShip
(id%%
).Ypos
, w%%
) = c_DESTROYER:
Next i%%
If o%%
= c_VERT
Then For i%%
= 0 To 2: m_arrBoard
(m_arrShip
(id%%
).Xpos
, m_arrShip
(id%%
).Ypos
+ i%%
, w%%
) = c_DESTROYER:
Next i%%
If o%%
= c_HORZ
Then For i%%
= 0 To 2: m_arrBoard
(m_arrShip
(id%%
).Xpos
+ i%%
, m_arrShip
(id%%
).Ypos
, w%%
) = c_SUBMARINE:
Next i%%
If o%%
= c_VERT
Then For i%%
= 0 To 2: m_arrBoard
(m_arrShip
(id%%
).Xpos
, m_arrShip
(id%%
).Ypos
+ i%%
, w%%
) = c_SUBMARINE:
Next i%%
If o%%
= c_HORZ
Then For i%%
= 0 To 1: m_arrBoard
(m_arrShip
(id%%
).Xpos
+ i%%
, m_arrShip
(id%%
).Ypos
, w%%
) = c_PTBOAT:
Next i%%
If o%%
= c_VERT
Then For i%%
= 0 To 1: m_arrBoard
(m_arrShip
(id%%
).Xpos
, m_arrShip
(id%%
).Ypos
+ i%%
, w%%
) = c_PTBOAT:
Next i%%
' /////////////////////////////////////////////////////////////////////////////
m_arrBoard(ix%%, iy%%, iz%%) = FALSE
' /////////////////////////////////////////////////////////////////////////////
' Player shooting, check enemy board
If m_arrBoard
(x%%
, y%%
, c_OPPONENT
) > 0 Then ItsAHit x%%, y%%, c_OPPONENT
Result%% = c_HIT
ElseIf m_arrBoard
(x%%
, y%%
, c_OPPONENT
) < 0 Then ' already hit or miss Result%% = c_BAD
Else ' space is empty so its a miss ItsAMiss x%%, y%%, c_OPPONENT
Result%% = c_MISS
' Opponent shooting, check player board
If m_arrBoard
(x%%
, y%%
, c_PLAYER
) > 0 Then ItsAHit x%%, y%%, c_PLAYER
Result%% = c_HIT
ElseIf m_arrBoard
(x%%
, y%%
, c_PLAYER
) < 0 Then ' already hit or miss Result%% = c_BAD
Else ' space is empty so its a miss ItsAMiss x%%, y%%, c_PLAYER
Result%% = c_MISS
UpdatePegLayer
SendShot = Result%%
' /////////////////////////////////////////////////////////////////////////////
_Dest m_arrLayer
(c_BOARD
) _PutImage (32, 32), m_arrLayer
(c_SHEET
), m_arrLayer
(c_BOARD
), (0, 0)-(262, 262) _PutImage (320, 32), m_arrLayer
(c_SHEET
), m_arrLayer
(c_BOARD
), (0, 0)-(262, 262) Line (32, 32)-(294, 294), c_BlueBoard~&
, BF
Line (320, 32)-(582, 294), c_RedBoard~&
, BF
' /////////////////////////////////////////////////////////////////////////////
If m_arrShip
(i%%
).Orent
= c_HORZ
Then DisplayShip m_arrOffs(i%%).Board_HX + (m_arrShip(i%%).Xpos - 1) * 24, m_arrOffs(i%%).Board_HY + (m_arrShip(i%%).Ypos - 1) * 24, i%%, m_arrShip(i%%).Orent, m_arrLayer(c_SHIPS) ' display ships in Board area
DisplayShip m_arrOffs(i%%).Board_VX + (m_arrShip(i%%).Xpos - 1) * 24, m_arrOffs(i%%).Board_VY + (m_arrShip(i%%).Ypos - 1) * 24, i%%, m_arrShip(i%%).Orent, m_arrLayer(c_SHIPS) ' display ships in Board area
If m_arrShip
(i%%
).Orent
= c_VERT
Then DisplayShip m_arrOffs(i%% - 5).RedBoard_VX + (m_arrShip(i%%).Xpos - 1) * 24, m_arrOffs(i%% - 5).RedBoard_VY + (m_arrShip(i%%).Ypos - 1) * 24, i%% - 5, m_arrShip(i%%).Orent, m_arrLayer(c_SHIPS) ' display ships in Board area
DisplayShip m_arrOffs(i%% - 5).RedBoard_HX + (m_arrShip(i%%).Xpos - 1) * 24, m_arrOffs(i%% - 5).RedBoard_HY + (m_arrShip(i%%).Ypos - 1) * 24, i%% - 5, m_arrShip(i%%).Orent, m_arrLayer(c_SHIPS) ' display ships in Board area
' /////////////////////////////////////////////////////////////////////////////
If z%%
= 1 Then ofx%
= 55: ofy%
= 55 Else ofx%
= 343: ofy%
= 55 _PutImage (ofx%
+ (x%%
- 1) * 24, ofy%
+ (y%%
- 1) * 24), m_arrLayer
(c_SHEET
), m_arrLayer
(c_PEGS
), (305, 144)-(327, 166) _PutImage (ofx%
+ (x%%
- 1) * 24, ofy%
+ (y%%
- 1) * 24), m_arrLayer
(c_SHEET
), m_arrLayer
(c_PEGS
), (329, 144)-(350, 166)
' /////////////////////////////////////////////////////////////////////////////
' Pick Who Goes first
starter%%
= Int(Rnd * 100) + 1
If m_GameData.Mode
= FALSE
Then ' if not a network game computer%%
= Int(Rnd * 100) + 1
' if game is network then
If m_GameData.Mode
= c_LAN
Then ' if this program is host game then send pick to player2 m_Message$ = "[PKN]" + m$
SendMessage
ElseIf m_GameData.Mode
= c_LANCLIENT
Then ' if this program is player 2 then wait for number Print "Awaiting Pick Number..." starter%% = m_GameData.NetWork.Y
m_GameData.NetWork.Y = 0
' client sends number first then waits.
' host waits first then sends number.
If m_GameData.Mode
= c_LANCLIENT
Then m_Message$ = "[FST]" + m$
SendMessage
computer%% = m_GameData.NetWork.X ' set player 2's number
m_GameData.NetWork.X = 0
If m_GameData.Mode
= c_LAN
Then ' send player 1's number to player 2 m_Message$ = "[FST]" + m$
SendMessage
If P%%
< 1 Or P%%
> 100 Then ' player auto lose Print "Opponent wins because you can not follow instructions." computer%% = starter%%
Else ' player entered correct ranged value Print "Opponent picks:"; computer%%
testp%%
= Abs(starter%%
- P%%
) ' find how far off player is. testc%%
= Abs(starter%%
- computer%%
) ' find how far off computer is. If testp%%
= testc%%
Then winner%%
= c_PLAYER
' in a tie player wins If testp%%
< testc%%
Then winner%%
= c_PLAYER
' player closer wins If testp%%
> testc%%
Then winner%%
= c_OPPONENT
' computer closer wins
Print "Control number was:";
If winner%%
= c_PLAYER
Then Print "You Win the chance to shoot first" Else Print "Opponent shoots first"
m_GameData.WhoIsUp = winner%% ' store who starts for later
' ---------------------------------------------
' /////////////////////////////////////////////////////////////////////////////
_PutImage , m_arrLayer
(c_BOARD
), m_arrLayer
(0) _PutImage (64, 300), m_arrLayer
(c_SHEET
), m_arrLayer
(c_BOARD
), (304, 6)-(499, 142)
_PrintString (304, 320), "Place Your fleet.", m_arrLayer
(c_BOARD
) _PrintString (304, 336), "Space to rotate ship.", m_arrLayer
(c_BOARD
) _PrintString (304, 352), "Left Click to select and place ship.", m_arrLayer
(c_BOARD
) _PrintString (304, 368), "Right Click to abort Placement.", m_arrLayer
(c_BOARD
)
If m_GameData.Mode
= c_LAN
Or m_GameData.Mode
= c_LANCLIENT
Then _PrintString (304, 384), "Game is in Network Mode.", m_arrLayer
(c_BOARD
)
_PutImage (304, 400), m_arrLayer
(c_SHEET
), m_arrLayer
(c_BOARD
), (24, 279)-(180, 322) ' accept button _PutImage (480, 400), m_arrLayer
(c_SHEET
), m_arrLayer
(c_BOARD
), (182, 279)-(338, 322) ' Reset button _Font 16, m_arrLayer
(c_MIX
)
AllPlaced%% = TRUE
If Not st_arrPicked
(i%%
) Then ' is ship 'in hand' or placed on board already? DisplayShip m_arrOffs(i%%).ShipYard_X, m_arrOffs(i%%).ShipYard_Y, i%%, c_HORZ, m_arrLayer(c_SHIPS) ' display ships in ShipYard area
AllPlaced%% = FALSE
_PutImage (64, 316 + (i%%
- 1) * 24), m_arrLayer
(c_SHEET
), m_arrLayer
(c_SHIPS
), (304, 22)-(424, 46) ' Erase ships from ShipYard area ' display ships placed on board
If m_arrShip
(i%%
).Xpos
<> 0 Then ' if ship has valid xpos then place on board If m_arrShip
(i%%
).Orent
= c_HORZ
Then DisplayShip m_arrOffs(i%%).Board_HX + (m_arrShip(i%%).Xpos - 1) * 24, m_arrOffs(i%%).Board_HY + (m_arrShip(i%%).Ypos - 1) * 24, i%%, m_arrShip(i%%).Orent, m_arrLayer(SHIPS) ' display ships in Board area
DisplayShip m_arrOffs(i%%).Board_VX + (m_arrShip(i%%).Xpos - 1) * 24, m_arrOffs(i%%).Board_VY + (m_arrShip(i%%).Ypos - 1) * 24, i%%, m_arrShip(i%%).Orent, m_arrLayer(SHIPS) ' display ships in Board area
End If ' otherwise ship must still be 'in-hand'
' move image to screen
' avoids flicker for the most part.
_PutImage , m_arrLayer
(c_BOARD
), m_arrLayer
(c_MIX
) _PutImage , m_arrLayer
(c_SHIPS
), m_arrLayer
(c_MIX
) If ShipSelection%%
Then DisplayShip x%
- 6, y%
- 6, ShipSelection%%
, ShipOrentation%%
, m_arrLayer
(c_MIX
)
If m_GameData.Mode
= c_LAN
Then If m_GameData.NetWork.Ready
Then _PrintString (304, 454), "Opponent is ready", m_arrLayer
(c_MIX
) _PrintString (304, 454), "Awaiting Opponent ship placement", m_arrLayer
(c_MIX
)
' *****************************************************************************
' debug information
' *****************************************************************************
If x%
> 54 And y%
> 54 And x%
< 294 And y%
< 294 Then ' mouse over player board ' highlite grid block that mouse is over(grid blocks are 22x22[24x24WL])
hx%% = ((x% - 54) \ 24) + 1: hy%% = ((y% - 54) \ 24) + 1
Line (54 + ((hx%%
- 1) * 24), 54 + ((hy%%
- 1) * 24))-(77 + ((hx%%
- 1) * 24), 77 + ((hy%%
- 1) * 24)), c_YellowSelect~&
, BF
' place ship on player board
If CheckShipPos
(hx%%
, hy%%
, ShipOrentation%%
, ShipSelection%%
) Then ' make sure ship fits m_arrShip(ShipSelection%%).Xpos = hx%%
m_arrShip(ShipSelection%%).Ypos = hy%%
m_arrShip(ShipSelection%%).Orent = ShipOrentation%%
PlaceShipOnBoard ShipSelection%%
held%% = 0
ShipSelection%% = 0
' -----------------------------------------------------------------------------
' Main input loop
If AllPlaced%%
And (held%%
= FALSE
) Then exitflag%%
= TRUE
'exitflag%% = TRUE
If ShipOrentation%%
= c_HORZ
Then ShipOrentation%%
= c_VERT
Else ShipOrentation%%
= c_HORZ
UpDateFlag%% = TRUE
st_arrPicked(i%%) = TRUE ' set true before using autopick
m_arrShip(i%%).Xpos = 0
m_arrShip(i%%).Ypos = 0
m_arrShip(i%).Orent = 0
ResetBoard
ClearLayer c_SHIPS
AutoPlaceShips c_PLAYER
UpDateFlag%% = TRUE
AutoFlag%% = TRUE
UpDateFlag%% = FALSE
' -----------------------------------------------------------------------------
' Ship Selection to place
If x%
> 64 And y%
> 316 And x%
< 245 And y%
< 432 Then ' player over ship yard hy2%% = ((y% - 316) \ 24) + 1
If Not st_arrPicked
(hy2%%
) Then ' make sure ship is still in the yard. ShipSelection%% = c_CARRIER: ShipOrentation%% = c_HORZ: st_arrPicked(1) = TRUE: held%% = 1
ShipSelection%% = c_BATTLESHIP: ShipOrentation%% = c_HORZ: st_arrPicked(2) = TRUE: held%% = 2
ShipSelection%% = c_DESTROYER: ShipOrentation%% = c_HORZ: st_arrPicked(3) = TRUE: held%% = 3
ShipSelection%% = c_SUBMARINE: ShipOrentation%% = c_HORZ: st_arrPicked(4) = TRUE: held%% = 4
ShipSelection%% = c_PTBOAT: ShipOrentation%% = c_HORZ: st_arrPicked(5) = TRUE: held%% = 5
' -----------------------------------------------------------------------------
exitflag%% = TRUE
_PutImage (304, 400), m_arrLayer
(c_SHEET
), m_arrLayer
(0), (24, 324)-(180, 367) ' accept button down
_PutImage (480, 400), m_arrLayer
(c_SHEET
), m_arrLayer
(0), (182, 324)-(338, 367) ' Reset button down st_arrPicked(i%%) = FALSE
m_arrShip(i%%).Xpos = 0
m_arrShip(i%%).Ypos = 0
m_arrShip(i%).Orent = 0
held%% = 0: ShipSelection%% = 0
ResetBoard
If AutoFlag%%
Then AutoFlag%%
= FALSE
ClearLayer c_SHIPS
' player is done but if network game pause here until Opponent is ready
ClearArea
_PrintString (304, 320), "Awaiting Opponent ship placement...", m_arrLayer
(0)
If m_GameData.Mode
= c_LAN
Then
' once client has given ship locations send hosts
m_Message$ = "[SHP]"
m_Message$ = m_Message$ + m$
m_Message$ = m_Message$ + m$
m_Message$
= m_Message$
+ LTrim$(Str$(m_arrShip
(i%%
).Orent
)) SendMessage
If m_GameData.Mode
= c_LANCLIENT
Then ' send host ship placement
m_Message$ = "[SHP]"
m_Message$ = m_Message$ + m$
m_Message$ = m_Message$ + m$
m_Message$
= m_Message$
+ LTrim$(Str$(m_arrShip
(i%%
).Orent
)) SendMessage
If m_GameData.Debug
Then dumpboard
' /////////////////////////////////////////////////////////////////////////////
Do ' wait until opponent sends shot packet ' if something happens to Opponent
If InKey$ = Chr$(27) Then m_GameData.NetWork.X
= 1: m_GameData.NetWork.Y
= 1: m_GameData.GameOver
= TRUE
x%% = m_GameData.NetWork.X
y%% = m_GameData.NetWork.Y
m_GameData.NetWork.X = 0
m_GameData.NetWork.Y = 0
MessageHandler
"Opponent fires at " + Chr$(64 + y%%
) + Str$(x%%
)
Case c_HIT
' Hits players ship MessageHandler "Opponent Hits!"
CheckShips
Case c_MISS
' Missed players ship MessageHandler "Opponent Misses"
Case c_BAD
' Already fired upon this space ERROR MessageHandler "Opponent has been Hitting the juice again, fired an error"
' /////////////////////////////////////////////////////////////////////////////
ClearLayer c_MIX
_Font m_arrFFX
(1), m_arrLayer
(c_LAN
) _PrintString (128, 32), "PORT ADDRESS FOR HOST", m_arrLayer
(c_LAN
) _Font m_arrFFX
(6), m_arrLayer
(c_LAN
) _PrintString (96, 64), "VALUE MUST BE GREATER THAN 1000", m_arrLayer
(c_LAN
) _PrintString (200, 84), "0 FOR DEFUALT PORT", m_arrLayer
(c_LAN
) _Font m_arrFFX
(5), m_arrLayer
(c_MIX
) ChangeColor
_RGB32(63, 208, 63), m_arrLayer
(c_MIX
)
port$ = "1945" ' defualt WWII port address
_PutImage , m_arrLayer
(c_LAN
), m_arrLayer
(c_MIX
) Line (268 + x%
, 158)-(292 + x%
, 162), _RGB32(255, 255, 0), BF
UpDate%% = TRUE
Port%
= Val(port$
): ExitFlag%%
= TRUE
Port% = 0: ExitFlag%% = TRUE
ExitFlag%% = TRUE
UpDate%% = TRUE
UpDate%% = FALSE
ExitFlag%% = FALSE
_Font 16, m_arrLayer
(c_LAN
)
m_GameData.NetWork.Host = StartHost(Port%)
If m_GameData.NetWork.Host
Then _Delay 1.5 ' give host a few secs to start up m_GameData.Mode = c_LAN
Timer(m_Listen&
) On ' turn on the timer to listen for opponent chatter
' connect host user
_PrintString (256, 464), "Connecting to host...", m_arrLayer
(0)
m_GameData.NetWork.Client = ConnectClient(Port%, "0")
' game is now in network mode
_Font m_arrFFX
(2), m_arrLayer
(c_MIX
)
' /////////////////////////////////////////////////////////////////////////////
ClearLayer c_MIX
_Font m_arrFFX
(1), m_arrLayer
(c_LAN
) _PrintString (128, 32), "PORT ADDRESS CONNECT TO", m_arrLayer
(c_LAN
) _PrintString (144, 168), "IP ADDRESS CONNECT TO", m_arrLayer
(c_LAN
) _Font m_arrFFX
(6), m_arrLayer
(c_LAN
) _PrintString (200, 84), "0 FOR DEFUALT PORT", m_arrLayer
(c_LAN
) _PutImage (32, 200), m_arrLayer
(c_SHEET
), m_arrLayer
(c_LAN
), (0, 376)-(575, 430)
_Font m_arrFFX
(5), m_arrLayer
(c_MIX
) ChangeColor
_RGB32(63, 208, 63), m_arrLayer
(c_MIX
) port$ = "1945" ' defualt WWII port address
If IPA$
= "" Then IPA$
= "LOCALHOST" selection%% = 2
_PutImage , m_arrLayer
(c_LAN
), m_arrLayer
(c_MIX
)
If x%
> 220 And x%
< 450 And y%
> 112 And y%
< 162 Then selection%%
= 1 ' port address If x%
> 40 And x%
< 600 And y%
> 200 And y%
< 250 Then selection%%
= 2 ' IP address update%% = TRUE
Line (268 + x%
, 158)-(292 + x%
, 162), _RGB32(255, 255, 0), BF
Line (x%
, 249)-(x%
+ 24, 253), _RGB32(255, 255, 0), BF
update%% = TRUE
Port%
= Val(port$
): ExitFlag%%
= TRUE
Port% = 0: ExitFlag%% = TRUE
ExitFlag%% = TRUE: m_Cancel%% = TRUE
update%% = TRUE
update%% = FALSE
ExitFlag%% = FALSE
_Font 16, m_arrLayer
(c_LAN
)
' connect host user
_PrintString (256, 464), "Connecting to host...", m_arrLayer
(0) m_GameData.NetWork.Client = ConnectClient(Port%, IPA$)
If m_GameData.NetWork.Client
Then m_GameData.Mode
= c_LANCLIENT
Timer(m_Listen&
) On ' turn on the timer to listen for opponent chatter
' /////////////////////////////////////////////////////////////////////////////
' Instructions
_Font m_arrFFX
(1), m_arrLayer
(c_MIX
) ChangeColor
_RGB32(212, 212, 212), m_arrLayer
(c_MIX
) ' Hover color ClearLayer c_MIX
DisplayShip 32, 64 + (32 * i%%), i%%, c_HORZ, m_arrLayer(c_MIX)
_PrintString (160, 96), "CARRIER TAKES 5 HITS", m_arrLayer
(c_MIX
) _PrintString (160, 128), "BATTLESHIP TAKES 4 HITS", m_arrLayer
(c_MIX
) _PrintString (160, 160), "DESTROYER TAKES 3 HITS", m_arrLayer
(c_MIX
) _PrintString (160, 192), "SUBMARINE TAKES 3 HITS", m_arrLayer
(c_MIX
) _PrintString (160, 224), "PT BOAT TAKES 2 HITS", m_arrLayer
(c_MIX
)
_Font m_arrFFX
(4), m_arrLayer
(c_MIX
) _PrintString (32, 256), "Ships can be palced vertically", m_arrLayer
(c_MIX
) _PrintString (32, 288), "on the game board by pressing", m_arrLayer
(c_MIX
) _PrintString (32, 320), "the space bar while the ship", m_arrLayer
(c_MIX
)
_PutImage (32, 400), m_arrLayer
(c_SHEET
), m_arrLayer
(c_MIX
), (305, 144)-(327, 166) _PutImage (32, 432), m_arrLayer
(c_SHEET
), m_arrLayer
(c_MIX
), (329, 144)-(350, 166)
_PrintString (64, 400), "-Denotes a hit.", m_arrLayer
(c_MIX
) _PrintString (64, 432), "-Denotes a miss.", m_arrLayer
(c_MIX
)
_Font 16, m_arrLayer
(c_MIX
) _PrintString (8, 464), "Press any key to return to menu", m_arrLayer
(c_MIX
)
_Font m_arrFFX
(2), m_arrLayer
(c_MIX
)
' ****************************************************************************************************************************************************************
' BEGIN DEBUGGING ROUTINES
' Routines Beyond are not Game nessesary
' ****************************************************************************************************************************************************************
' /////////////////////////////////////////////////////////////////////////////
' debugging
Print #6, m_arrBoard
(x%%
, y%%
, z%%
);
' /////////////////////////////////////////////////////////////////////////////
' ****************************************************************************************************************************************************************
' END DEBUGGING ROUTINES
' ****************************************************************************************************************************************************************