'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$, iconHandle
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
open dd$+"data\extra\credit and copyright.txt" for input as #msg
while eof(#msg)=0
input #msg, holder$
if returnFeedCheck <> 0 then creditMsg$ += chr$(13)
creditMsg$ += holder$
returnFeedCheck += 1
wend
creditMsg$ += chr$(13)+chr$(13)+"You can find a better version of this list in the file entitled credits and copyright.txt in the data\extra folders.": close #msg
BackgroundColor$ = "160 96 52"
dim gameFilesInfo$(9, 9): dim fileList$(0)
[mainMenu]
gosub [refreshFileList]: refreshComboBoxFlag = 1
WindowWidth = 363: WindowHeight = 260
UpperLeftX = int((DisplayWidth-WindowWidth)/2): UpperLeftY = int((DisplayHeight-WindowHeight)/2)
button #main.default, "Play (Enter)", [gameSetup], UL, 5, 165, 170, 30
button #main.about, "About File", [aboutFile], UL, 180, 165, 170, 30
button #main.delete, "Delete", [deleteFile], UL, 5, 195, 170, 30
button #main.quit, "Quit", [quit], UL, 180, 195, 170, 30
combobox #main.gamefiles, fileList$(), [wait], 5, 135, 345, 30
bmpbutton #main.logo, dd$+"bitmaps\logo.bmp", [aboutGame], UL, 5, 5
open "Awakening" for dialog_popup as #main
hwin = hwnd(#main): #main "trapclose [quit] ; font ms_sans_serif bold 10"
#main.gamefiles "refresh": call applyIcon hwin
[wait]
wait
[aboutFile]
call getFileInfo
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+1)+" have "+word$("??? ????? ??????!,the stone tablet!", profile.secretItem.struct+1, ",")
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_ICONWARNING 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": gosub [refreshFileList]
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]
#main.gamefiles "contents? fileName$"
if val(gameFilesInfo$(0, 0))-1 <> 0 then
for loopVar = 0 to val(gameFilesInfo$(0, 0))-1
if fileName$ = fileList$(loopVar) then
notice "This name has already been used! So Awakening will create the file for you."
open dd$+"\data\"+fileName$+".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
end if
next
end if
if nameOfFile$ = "" then notice "No file selected!"+chr$(13)+"There is nothing selected/typed in the combobox! Type in a file name not used to create a new file called the name typed, or select an existing file in the combobox list.": wait
call getFileInfo
[quit]
close #main
calldll #user32, "DestroyIcon", iconHandle as ulong, r as boolean
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
[refreshFileList]
files dd$+"data\", "*.dat", gameFilesInfo$()
redim fileList$(val(gameFilesInfo$(0, 0))-1)
if val(gameFilesInfo$(0, 0))-1 <> 0 then
for loopVar = 0 to val(gameFilesInfo$(0, 0))-1
fileList$(loopVar) = left$(gameFilesInfo$(loopVar+1, 0), len(gameFilesInfo$(loopVar+1, 0))-4)
next
end if
if refreshComboBoxFlag = 1 then #main.gamefiles "refresh"
if gameFilesInfo$(0, 0) = "0" then
notice "There are no game files in the data directory!"+chr$(13)+"In order to continue, Awakening will need to make one game file."
prompt "What do you wish to call your file?";newFileName$
if newFileName$ = "" then notice "Awakening will quit!": goto [quit]
open dd$+"data\"+newFileName$+".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
end if
return
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 sub
sub getFileInfo
#main.gamefiles "selection? nameOfFile$"
open dd$+"data\"+nameOfFile$+".dat" for input as #file
input #file, profile.point.struct: input #file, profile.itemC.struct
input #file, profile.itemV.struct: input #file, profile.itemB.struct
input #file, profile.itemN.struct: input #file, profile.itemM.struct
input #file, profile.secretItem.struct: close #file
end sub