'Awakening v1.0.0's first coding day was 24/04/2015. The project was reworked on the 1/05/2015 and has been continued to
on error goto [crash]
nomainwin: struct profile, point as ushort, itemC as ushort, itemV as ushort, itemB as ushort, itemN as ushort, itemM as ushort, secretItem as boolean
global iconDir$, dd$
dd$ = DefaultDir$+"\"
iconDir$ = dd$+"bitmaps\icon.ico"
aboutFlags = _MB_ICONINFORMATION or _MB_OK or _MB_SETFOREGROUND
aboutGameFlags = _MB_ICONINFORMATION or _MB_OK or _MB_TOPMOST
BackgroundColor$ = "160 96 52"
dim gameFilesInfo$(9, 9): dim fileList$(0)
[mainMenu]
call refreshFileList
WindowWidth = 370: WindowHeight = 265
UpperLeftX = int((DisplayWidth-WindowWidth)/2): UpperLeftY = int((DisplayHeight-WindowHeight)/2)
button #main.default, "Play (Enter)", [gameSetup], UL, 5, 160, 170, 30
button #main.about, "About", [aboutFile], UL, 180, 160, 170, 30
button #main.delete, "Delete", [deleteFile], UL, 5, 195, 170, 30
button #main.new, "New File", [newFile], UL, 5, 135, 345, 300
combobox #main.fileList, fileList$(), [files], 180, 195, 170, 30
bmpbutton #main.logo, dd$+"bitmaps\logo.bmp", [aboutGames], UL, 5, 5
open "Awakening" for dialog as #main
hwin = hwnd(#main): #main "trapclose [quit] ; font ms_sans_serif 10"
#main.fileList "selectindex 1": call applyIcon hwin
[files]
#main.fileList "selection? nameOfFile$"
open dd$+"data\"+nameOfFile$+".dat" for input as #file
for loopVar = 1 to 7
input #file, r
select case loopVar
case 1
profile.point.struct = r
case 2
profile.itemC.struct = r
case 3
profile.itemV.struct = r
case 4
profile.itemB.struct = r
case 5
profile.itemN.struct = r
case 6
profile.itemM.struct = r
case 7
profile.secretItem.struct = r
end select
next
close #file: wait
[aboutFile]
aboutMessage$ = "Animation Clip/Progress: ";profile.point.struct;chr$(13)+"Item at key C: "+word$("Sling Shot,Bow,Wand of Levitation,Wand of Mobility,Wand of Mobile Levitation,Tourches,Pendant of Agility,Pendant of Protection,Pendant of Smite,Stone Tablet", profile.itemC.struct, ",")+chr$(13)+"Item at key V: "+word$("Sling Shot,Bow,Wand of Levitation,Wand of Mobility,Wand of Mobile Levitation,Tourches,Pendant of Agility,Pendant of Protection,Pendant of Smite,Stone Tablet", profile.itemV.struct, ",")+chr$(13)+"Item at key B: "+word$("Sling Shot,Bow,Wand of Levitation,Wand of Mobility,Wand of Mobile Levitation,Tourches,Pendant of Agility,Pendant of Protection,Pendant of Smite,Stone Tablet", profile.itemB.struct, ",")+chr$(13)+"Item at key N: "+word$("Sling Shot,Bow,Wand of Levitation,Wand of Mobility,Wand of Mobile Levitation,Tourches,Pendant of Agility,Pendant of Protection,Pendant of Smite,Stone Tablet", profile.itemN.struct, ",")+ chr$(13)+"Item at key M: "+word$("Sling Shot,Bow,Wand of Levitation,Wand of Mobility,Wand of Mobile Levitation,Tourches,Pendant of Agility,Pendant of Protection,Pendant of Smite,Stone Tablet", profile.itemM.struct, ",")+chr$(13)+"You "+word$("don't do", profile.secretItem.struct)+" have "+word$("??? ????? ??????!,the stone tablet!", profile.secretItem.struct, ",")
aboutCaption$ = "About File "+nameOfFile$
calldll #user32, "MessageBoxExA", hwin as ulong, aboutMessage$ as ptr, aboutCaption$ as ptr, aboutFlags as long, 0 as word, r as long
wait
[deleteFile]
calldll #user32, "MessageBeep", _MB_ICONERROR as long, r as boolean
confirmCaption$ = "Are you sure you want to delete file "+nameOfFile$+"?"
confirm confirmCaption$;r$
if r$ = "no" then wait
kill dd$+"data\"+nameOfFile$+".dat": call refreshFileList
#main.fileList "refresh": wait
[newFile]
prompt "Please name your new file";newName$
if newName$ = "" then wait
for loopVar = 0 to val(gameFilesInfo$(0, 0))-1
if newName$ = fileList$(loopVar) then notice "This name has already been used!": goto [newFile]
next
open dd$+"data\"+newName$+".dat" for output as #newFile
#newFile "0"+chr$(13)+"0"+chr$(13)+"0"+chr$(13)+"0"+chr$(13)+"0"+chr$(13)+"0"+chr$(13)+"0": close #newFile
call refreshFileList: #main.fileList "refresh": wait
[aboutGame]
calldll #user32, "MessageBoxExA", hwin as ulong, creditMsg$ as ptr, "About Awakening!" as ptr, aboutGameFlags as long, 0 as word, r as long
wait
[gameSetup]
[quit]
close #main: end
[crash]
crashMessage$ = Err$+" (Code: ";Err+chr$(13)+"If you are having serious problems visit http://www.awakening_by_datwill310.com!"
crashFlags = _MB_ICONERROR or _MB_OK or _MB_TOPMOST
calldll #user32, "MessageBoxExA", hwin as ulong, crashMessage$ as ptr, "Awakening Crashed!" as ptr, crashFlags as long, 0 as word, r as long
end
sub refreshFileList
files dd$+"data\", "*.dat", gameFilesInfo$()
redim fileList$(val(gameFilesInfo$(0, 0))-1)
loopVar = 0
for loopVar = 0 to val(gameFilesInfo$(0, 0))-1
fileList$(loopVar) = left$(gameFilesInfo$(loopVar+1, 0), len(gameFilesInfo$(loopVar+1, 0))-4)
next
end sub
sub applyIcon windowHandle
flag = _LR_LOADFROMFILE or _LR_DEFAULTSIZE
setIconFlag = 0 or 1
calldll #user32, "GetWindowLongA", windowHandle as ulong, _GWL_HINSTANCE as long, hInst as ulong
calldll #user32, "LoadImageA", hInst as ulong, iconDir$ as ptr, _IMAGE_ICON as long, 0 as long, 0 as long, flag as long, iconHandle as ulong
calldll #user32, "SendMessageA", windowHandle as ulong, _WM_SETICON as long, setIconFlag as long, iconHandle as ulong, r as long
end function