Guys,
Been working a little on getting more of the intex working.
Rob, I have sent you an email with a new font to try.So update the following:
Add:
Players.bb
Function DrawMapPlan()
For p.player=Each player
If p = First player Then xx=p\x/32:yy=p\y/32
Next
For x=-80 To 80
For y=-64 To 64
If x+xx>-1 And x+xx<256 And y+yy>-1 And y+yy<256
If map(x+xx,y+yy,LayerCollision)>0 And map(x+xx,y+yy,layer_visible)>0
If map(x+xx,y+yy,LayerCollision)=czVisDynamic
; dynamic
Color 100,200,100
Else
; static
Color 0,20,0
EndIf
Rect 320+(x*2),240+(y*2),2,2
EndIf
EndIf
Next
Next
c=255
For p.player=Each player
If p = First player Then Color c,0,0 Else Color 0,0,c
Rect 320+((xx-(Floor(p\x/32)))*2),240+((yy-(Floor(p\y/32)))*2),2,2
c=c-1
If c=150 Then c=255
Next
End Function
Update:
;Function handleBullets() - Weapons.bb
For al.alien = Each alien
If ImagesCollide(bulletgfx,b\x,b\y,1, al\image,al\x-al\offset,al\y-al\offset,al\dir)
;circlesoverlap(al\x,al\y,al\radius,bx+16,by+16,3)
killed = alien_hit(al,b\damage)
If killed = True And b\scenary<>1 Then
;Update counter for player status
b\owner\kills = b\owner\kills + 1
End If
ok=False ;bullet hit alien
EndIf
Next
Update:
;Function Runscript - script.bb
Case "addhealth"
;Give health to player
Player_GiveHealth(pl, si\param)
[/code]
Replace - Intex-New.bb
[code]
;Images
Global intexBackground = LoadImage("gfx\intexbg.png")
Global intexFrame = LoadImage("gfx\intex-frame.png")
Global intexText = LoadAnimImage("gfx\intex-text-sm4.png",8,10,0,41)
MaskImage intexText,255,0,255
;Global intexWeapon = LoadAnimImage("gfx\intex-weapons.png",320,88,0,6)
;MaskImage intexWeapon,255,0,255
Global bfont = LoadAnimImage("gfx\bitfnt.png",5,5,0,100)
Function btext(x,y,t$,hcentre=False,vcentre=False)
If hcentre Then x=x-(Len(t)*3)
If vcentre Then y=y-3
For n=1 To Len(t)
DrawImage bfont,x,y,Asc(Mid(t,n,1))-32
x=x+6
Next
End Function
Global intexChars$ = "*ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:?!"
Const pauseMax = 75
Const maxLines = 20
Const draw_char_delay_time=5
Const charWidth = 7
Const xOffset = 160
Const yOffset = 112
Type MenuSystem
Field id
Field build
Field bChar
Field bLine
Field menuText$[maxLines]
Field x[maxLines]
Field y[maxLines]
Field subMenu[maxLines]
Field highlight[maxLines]
Field total
Field pauseCounter
Field cursorRow
Field cursorX
Field cursorY
Field bCharCounter
End Type
Global intexMenu.MenuSystem
Global gotr
Global gotg
Global gotb
Function GetRGB(image_name,x,y)
argb=ReadPixelFast(x,y,ImageBuffer(image_name))
gotr=(ARGB Shr 16) And $ff
gotg=(ARGB Shr 8) And $ff
gotb=ARGB And $ff
End Function
Function WriteRGB(image_name,x,y,red,green,blue)
argb=(blue Or (green Shl 8) Or (red Shl 16) Or ($ff000000))
WritePixelFast x,y,argb,ImageBuffer(image_name)
End Function
Function halfbright(source1,x1,y1,bias#)
result = CreateImage(ImageWidth(source1),ImageHeight(source1))
source2 = CreateImage(ImageWidth(source1),ImageHeight(source1))
GrabImage source2,x1,y1
LockBuffer ImageBuffer(source1)
LockBuffer ImageBuffer(source2)
LockBuffer ImageBuffer(result)
For x=0 To ImageWidth(source1)-1
For y=0 To ImageHeight(source1)-1
GetRGB(source1,x,y)
r1#=gotr
g1#=gotg
b1#=gotb
GetRGB(source2,x,y)
r2#=gotr
g2#=gotg
b2#=gotb
r3#=(r1*bias)+(r2*(1-bias))
g3#=(g1*bias)+(g2*(1-bias))
b3#=(b1*bias)+(b2*(1-bias))
WriteRGB(result,x,y,r3,g3,b3)
Next
Next
UnlockBuffer ImageBuffer(source1)
UnlockBuffer ImageBuffer(source2)
UnlockBuffer ImageBuffer(result)
Return result
End Function
Function IntexMenu(pl.player)
Local currentMenu = 0
Local exitMenu = False
Local preBootCounter = 0
Local menuUpdateCounter
;Create a menu store
intexMenu.MenuSystem = New MenuSystem
;Get the boot text
GetMenuText(currentMenu,pl)
ibg = halfbright(intexbackground,xoffset,yoffset,.8)
While Not exitMenu = True
;Set buffer
SetBuffer BackBuffer()
;Draw
DrawBlock intexFrame,xOffset-15,yOffset-12
DrawBlock ibg,xOffset,yOffset
;Drawtext
ProcessMenuText(pl)
;Individual menu functions
If intexMenu\build = False Or currentMenu = 11 Then
Select currentMenu
Case 0 ;Intex Boot
;Set menu to Main Menu
currentMenu = 1
GetMenuText(currentMenu,pl)
Case 1,2,3 ;Main Menu
DrawImage intexText,32+xOffset,intexMenu\y[intexMenu\highlight[intexMenu\cursorRow]], 0
;Menu Up/Down
If menuUpdateCounter = 0 Then
If control(pUp,pl\id) And intexMenu\cursorRow > 1 Then
intexMenu\cursorRow = intexMenu\cursorRow - 1
menuUpdateCounter = 10
ElseIf control(pDown,pl\id) And intexMenu\highlight[intexMenu\cursorRow + 1] <> 0 Then
intexMenu\cursorRow = intexMenu\cursorRow + 1
menuUpdateCounter = 10
End If
Else
;Control the speed of the menu movement
If menuUpdateCounter > 0 Then
menuUpdateCounter = menuUpdateCounter - 1
End If
End If
;Menu select
If control(pfire1,pl\id) And intexMenu\subMenu[intexMenu\highlight[intexMenu\cursorRow]] > 0 Then
currentMenu = intexMenu\subMenu[intexMenu\highlight[intexMenu\cursorRow]]
GetMenuText(currentMenu,pl)
End If
Case 4 ;Radar Service
DrawMapPlan()
If control(pfire1,pl\id) Then
currentMenu = 1
GetMenuText(currentMenu,pl)
End If
Case 7
If control(pfire1,pl\id) Then
;Return to main menu
currentMenu = 1
GetMenuText(currentMenu,pl)
End If
Case 10 ;Disconnect
exitMenu = True
End Select
End If
;Draw
Flip True
Wend
;Clear keys
FlushKeys()
;Tidyup
Delete Each menuSystem
End Function
Function GetMenuText(menu, pl.player)
Local totalLines, lines
Local lineText$, x, y, subMenu, max
Local highlight
;Wait until no fire keys
While control(pfire1, pl\id)
Wend
;Set remaining fields
intexMenu\build = True
intexMenu\bChar = 0
intexMenu\bLine = 1
intexMenu\id = menu
intexMenu\pauseCounter = 0
intexMenu\cursorRow = 1
intexMenu\bCharCounter = 0
Select menu
Case 0 ;Intex Boot
Restore menuIntexBoot
Case 1 ;Menu
Restore menuIntexMain
Case 2 ;Weapon Supplies
Restore menuIntexWeaponsSupply
Case 3 ;Tool Supplies
Restore menuIntexToolSupply
Case 4 ;Radar Service
Restore menuIntexRadarService
;intexMenu\build = False
Case 7 ;Statistics
Restore menuIntexStatistics
Case 10 ;Disconnect
Restore menuIntexDisconnect
End Select
;Clear
For lines = 1 To maxLines
intexMenu\highlight[lines] = 0
intexMenu\menuText$[lines] = ""
Next
;Process the data?
If intexmenu\build = True Then
;Read the data
Read totalLines
For lines = 1 To totalLines
Read lineText, x, y, subMenu, highlight
intexMenu\menuText$[lines] = UpdateTags(Upper(lineText), pl)
intexMenu\x[lines] = x + xOffset
intexMenu\y[lines] = y + yOffset
intexMenu\subMenu[lines] = subMenu
;Set line selection
If highlight <> -1 Then
intexMenu\highlight[highlight] = Lines
End If
Next
;Set remaining fields
intexMenu\total = totalLines + 1
End If
;Clear keys
FlushKeys()
End Function
Function UpdateTags$(lineText$, pl.player)
;Update tags
lineText = Replace(lineText,"%PLSCORE%",LSet(pl\score,6))
lineText = Replace(lineText,"%PLKILLS%",pl\kills)
;lineText = Replace(lineText,"%PLCREDITS%",LSet(pl\credits,6))
;lineText = Replace(lineText,"%PLSHOTS%",LSet(pl\shots,6))
;lineText = Replace(lineText,"%PLDOORS%",LSet(pl\doors,6))
;lineText = Replace(lineText,"%PLAMMO%",LSet(pl\clip,6))
lineText = Replace(lineText,"%PLCREDITS%",pl\credits)
lineText = Replace(lineText,"%PLSHOTS%",pl\shots)
lineText = Replace(lineText,"%PLDOORS%",pl\doors)
lineText = Replace(lineText,"%PLAMMO%",pl\clip)
lineText = Replace(lineText,"%PLENERGY%","GOOD")
lineText = Replace(lineText,"%PLCURRENTWEAPON%",Upper(pl\weapon\name)) ;Current
lineText = Replace(lineText,"%WBROADHURST%",WeaponStatus(pl\ownedWeapons[1]))
lineText = Replace(lineText,"%WDALTON%",WeaponStatus(pl\ownedWeapons[2]))
lineText = Replace(lineText,"%WROBINSON%",WeaponStatus(pl\ownedWeapons[3]))
lineText = Replace(lineText,"%WRYXX%",WeaponStatus(pl\ownedWeapons[4]))
lineText = Replace(lineText,"%WSTYRLING%",WeaponStatus(pl\ownedWeapons[5]))
lineText = Replace(lineText,"%WIMPACT%",WeaponStatus(pl\ownedWeapons[6]))
;Return
Return lineText
End Function
Function WeaponStatus$(wp.weapon)
If wp<>Null Then
Return "YES"
End If
Return " NO"
End Function
Function ProcessMenuText(pl.player)
Local currentChar$,x,y,maxChar,char
Local charCounter = 0
Local drawCursor = False
Local finishProcess = False
If intexMenu\build Then
If intexMenu\bChar > 0 Then
;Get the current char
Repeat
currentChar = Mid(intexMenu\menuText[intexMenu\bLine],intexMenu\bChar,1)
If currentChar = " " And intexMenu\bChar < Len(intexMenu\menuText[intexMenu\bLine]) - 1 Then
;Skip over any spaces
intexMenu\bCharCounter = intexMenu\bCharCounter + 1
intexMenu\bChar = intexMenu\bChar + 1
ElseIf currentChar = "+" Then
;We need to pause
intexMenu\pauseCounter = (intexMenu\pauseCounter +1) Mod pauseMax
Exit
Else
;Exit out
Exit
End If
Forever
End If
;Continue to process text
If intexMenu\pauseCounter = 0 Then
;Increment number of shown characters
intexMenu\bCharCounter = intexMenu\bCharCounter + 1
;Increment char
intexMenu\bChar = (intexMenu\bChar + 1) Mod Len(intexMenu\menuText[intexMenu\bLine])
If intexMenu\bChar = 0 Then
;Increment line
intexMenu\bLine = (intexMenu\bLine + 1) Mod intexMenu\total
If intexMenu\bLine = 0 Then
finishProcess = True
End If
End If
End If
;Speed up menu process (fire key) - temp?
If KeyDown(1) Then
finishProcess = True
End If
;Finish?
If finishProcess Then
;Set each item to it's max
intexMenu\bLine = intexMenu\total - 1
intexMenu\bChar = Len(intexMenu\menuText[intexMenu\bLine])
;Finish
intexMenu\build = False
FlushKeys()
End If
End If
;Draw text
For drawLine = 1 To intexMenu\bLine
;Set co-ords for current line
x = intexMenu\x[drawLine]
y = intexMenu\y[drawLine]
;Draw current line
For drawChar = 1 To Len(intexMenu\menuText[drawLine])
;Increment letter count
charCounter = charCounter + 1
;Get current char
char = Instr(intexChars, Mid(intexMenu\menuText[drawLine],drawChar,1)) - 1
If char > -1 Then
DrawImage intexText,x,y,char
End If
;Building the menu, if so pause on last char and display cursor
If intexMenu\build Then
;Slight pause when first displaying character?
If (charCounter = intexMenu\bCharCounter) Then
Delay draw_char_delay_time
intexMenu\cursorX = x
intexMenu\cursory = y
drawCursor = True
Exit
End If
End If
x = x + charWidth
Next
If drawCursor Then
DrawImage intexText,intexMenu\cursorX,intexMenu\cursorY,0
Exit
End If
Next
End Function
;Data Structure
;No of lines
;Text$,X,Y,SubMenu
.menuIntexBoot
Data 10
Data "INTEX NETWORK CONNECT: CODE ABF01DCC60 ",8,48,-1,-1
Data "CONNECTING..................... ",8,60,-1,-1
Data "INTEX NETWORK SYSTEM V10.0 ",8,84,-1,-1
Data "2G RAM: OK ",8,96,-1,-1
Data "EXTERNAL DEVICE: OK ",8,108,-1,-1
Data "SYSTEM V1.10 CS: OK ",8,120,-1,-1
Data "VIDEODISPLAY: DAMAGED+ ",8,132,-1,-1
Data "EXECUTING DOS 5.0 ",8,156,-1,-1
Data "SYSTEM DOWNLOADING NETWORKDATA..... OK ",8,168,-1,-1
Data "INTEX EXECUTED!+ ",8,180,-1,-1
.menuIntexMain
Data 8
Data "INTEX MAIN MENU ",96,32,-1,-1
Data "INTEX WEAPON SUPPLIES ",72,68,-1,1
Data "INTEX TOOL SUPPLIES ",80,80,3,2
Data "INTEX RADAR SERVICE ",80,92,4,3
Data "LEVEL INFORMATION UPDATE ",64,104,-1,4
Data "INTEX ENTERTAINMENT ",80,116,-1,5
Data "STATISTICS ",120,128,7,6
Data "EXIT INTEX NETWORK ",88,140,10,7
.menuIntexWeaponsSupply
Data 2
Data "INTEX WEAPON SUPPLIES ",122,24,-1,-1
Data "WEAPON SUPPLIES REQUEST: ",24,48,-1,-1
.menuIntexToolSupply
Data 8
Data "INTEX TOOL SUPPLIES ",80,36,-1,-1
Data "ELECTRONIC HAND MAP 500 CR ",32,72,-1,1
Data "AMMO NYBBLE 1000 CR ",32,96,-1,2
Data "FIRST AID KIT 2000 CR ",32,120,-1,3
Data "6 KEYS 4000 CR ",32,144,-1,4
Data "EXTRA LIFE 10000 CR ",32,168,-1,5
Data "EXIT ",144,192,1,6
Data "YOUR CREDIT LIMIT IS: %PLCREDITS% CR ",40,216,-1,-1
.menuIntexRadarService
Data 1
Data "INTEX RADAR SERVICE ",88,36,-1,-1
.menuIntexStatistics
Data 16
Data "INTEX STATISTICS ",96,16,-1,-1
Data " PLAYER SCORES: %PLSCORE% PTS ",16,40,-1,-1
Data " ALIENS KILLED: %PLKILLS% ",16,52,-1,-1
Data " SHOTS FIRED: %PLSHOTS% BULLETS ",16,64,-1,-1
Data " CREDITS OWNED: %PLCREDITS% CR ",16,76,-1,-1
Data " DOORS OPENED: %PLDOORS% ",16,88,-1,-1
Data " AMMO OWNED: %PLAMMO% CLIP",16,100,-1,-1
Data " ENERGY STATE: %PLENERGY% ",16,112,-1,-1
Data "CURRENT WEAPON: %PLCURRENTWEAPON%",16,124,-1,-1
Data "WEAPONS STATUS: ",16,136,-1,-1
Data weaponBroadhurst + "... %WBROADHURST% ",40,160,-1,-1 ;112
Data weaponDalton + "... %WDALTON% ",40,172,-1,-1
Data weaponRobinson + "... %WROBINSON% ",40,184,-1,-1
Data weaponRyxx + "... %WRYXX% ",40,196,-1,-1
Data weaponStyrling + "... %WSTYRLING% ",40,208,-1,-1
Data weaponImpact + "... %WIMPACT% ",40,220,-1,-1
.menuIntexDisconnect
Data 1
Data "DISCONNECTING..............+ ",16,32,-1,-1