Skip to content

PR #4 Create PLAYABLE program #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bd82c40
fet: create copy folder for builder
kostyabet Nov 19, 2024
e2164aa
fix: create basic readme for setup
kostyabet Nov 19, 2024
5da3747
fet: create exit page
kostyabet Nov 19, 2024
1e47a7e
fet: add exit page with Q
kostyabet Nov 19, 2024
fa4bab5
fet: draw hotkeys position blocks
kostyabet Nov 19, 2024
944180f
fet: add ESP
kostyabet Nov 19, 2024
79ea542
fet: create save in file game board function
kostyabet Nov 24, 2024
78a0d6a
fix: change ini file naming
kostyabet Nov 26, 2024
d267921
fet: create about page font panel
kostyabet Nov 27, 2024
28c950a
fix: change bytes count for one circle draw
kostyabet Nov 27, 2024
84af9d8
fix: create heap strings for memory control
kostyabet Nov 27, 2024
8bac9bc
fet: modified build by use bash scripts
kostyabet Nov 27, 2024
2f77507
fet: finalize builder updates
kostyabet Nov 27, 2024
f65261f
fix: game ini file rewrite after Alt+F4 exit
kostyabet Nov 27, 2024
24e2ba4
fet: create fas file with labels for olly dbg
kostyabet Nov 27, 2024
65e8198
fet: create script for text convertation
kostyabet Nov 28, 2024
4f74093
fix: change encodings fixes
kostyabet Nov 28, 2024
feea0b3
fet: create about page
kostyabet Nov 28, 2024
f41ff15
fet: fix some letters
kostyabet Nov 28, 2024
fedf95b
fix: change hotkeys labels from change to see
kostyabet Nov 28, 2024
b26e755
fet: create labels with hotkeys info
kostyabet Nov 29, 2024
0882121
fet: create new special symbols
kostyabet Nov 29, 2024
be13766
fix: add skip file reading if file size = 0
kostyabet Nov 29, 2024
1115b99
fix: add strings memory free functoin
kostyabet Nov 29, 2024
5a63af7
fix: change clobber flag
kostyabet Nov 29, 2024
942213e
fet: create hotkeys info output
kostyabet Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
/Debug
/Release
bin/
settings.txt
settings.ini
ticks.ini
builder/
tactickgame.fas

# temp close
.github/
Expand All @@ -18,3 +21,8 @@ build.yml/

# Texture Packer resource files
Graphics/Draw/ASCII/TextureAtlases/Resources


# node js temp
node_modules/
package-lock.json
3 changes: 2 additions & 1 deletion Application/Includes.asm
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include '_components/Exit.asm'
include '_components/Exit.asm'
include '_components/FreeMemory.asm'
7 changes: 6 additions & 1 deletion Application/_components/Exit.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
proc Application.Exit
stdcall File.IniFile.Write
stdcall File.TicksPosition.Write
stdcall Application.FreeMamory
invoke HeapDestroy, [hHeap]
invoke ExitProcess, [msg.wParam]
invoke wglMakeCurrent,0,0
invoke wglDeleteContext,[hrc]
invoke ReleaseDC,[hwnd],[hdc]
invoke PostQuitMessage,0
ret
endp
16 changes: 16 additions & 0 deletions Application/_components/FreeMemory.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
proc Application.FreeMamory
stdcall Application.FreeArray, [txts_array]
ret
endp

proc Application.FreeArray uses eax ebx,\
array
mov ebx, [array]
.freeLoop:
invoke HeapFree, [hHeap], 0, [ebx]
add ebx, 4
mov eax, [ebx]
cmp eax, 0
jne .freeLoop
ret
endp
5 changes: 4 additions & 1 deletion File/Includes.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ include 'BMP/LoadBoat.asm'
include 'BMP/BMP.inc'
; init settings file
include 'Settings/IniFile.asm'
include 'Settings/Settings.inc'
include 'Settings/Settings.inc'
; ticks
include 'TicksPositions/Ticks.asm'
include 'TicksPositions/TicksPosition.inc'
47 changes: 45 additions & 2 deletions File/Settings/IniFile.asm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ proc File.IniFile.Read uses eax ebx ecx edx edi
invoke HeapAlloc, [hHeap], 8, [bufferLength]
mov [readBuffer], eax
invoke ReadFile, [hIniFile], [readBuffer], [bufferLength], bytesRead, 0
cmp [bytesRead], 0
je @F
; ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ;
; !!!!!!!!!!!!!!!!!!!!!!!!!!! DO NOT TOUCH EDI !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ;
mov edi, [readBuffer]
Expand All @@ -56,7 +58,8 @@ proc File.IniFile.Read uses eax ebx ecx edx edi
stdcall File.IniFIle.ReadString, HK_SETTINGS, 0
stdcall File.IniFIle.ReadString, HK_RESTART, 0
; !!!!!!!!!!!!!!!!!!!!! ALARM DIACTIVATE! GOOD LUCK :) !!!!!!!!!!!!!!!!!!!!!!!! ;
invoke HeapFree, [hHeap], 0, [readBuffer]
@@:
invoke HeapFree, [hHeap], 0, [readBuffer]
.exit:
invoke CloseHandle, [hIniFile]
ret
Expand Down Expand Up @@ -187,6 +190,46 @@ proc File.IniFile.IntToStr uses ecx edx ebx esi,\
ret
endp

proc File.IniFile.ArrIntToStr uses eax ebx edx ecx,\
prompt, arr, size
stdcall File.IniFile.WriteLine, [prompt]
mov ecx, [size]
mov ebx, [arr]
.convertLoop:
push ecx
mov edx, [ebx]
stdcall File.IniFile.IntToStr, edx
stdcall File.IniFile.WriteLine, strBuffer
pop ecx
add ebx, 4
loop .convertLoop
mov eax, arrayBuffer
stdcall File.IniFile.WriteLine, NEXT_LINE
ret
endp

proc File.IniFile.StrToArrInt uses eax ebx ecx,\
arr, size
stdcall File.IniFile.ReadRule, edi
push edi

mov edi, strBuffer
mov ecx, [size]
mov ebx, [arr]
.convertLoop:
xor eax, eax
mov al, byte [edi]
sub eax, '0'
mov [ebx], eax
add ebx, 4
inc edi
loop .convertLoop
mov eax, arrayBuffer

pop edi
ret
endp

proc File.IniFile.WriteRule,\
prompt, status
stdcall File.IniFile.WriteLine, [prompt]
Expand All @@ -195,7 +238,7 @@ proc File.IniFile.WriteRule,\
ret
endp

proc File.IniFile.WriteLine,\
proc File.IniFile.WriteLine uses eax,\
message
locals
messageLen dd ?
Expand Down
3 changes: 2 additions & 1 deletion File/Settings/IniFile.inc
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
hIniFile dd ?
iniFilePath db 'settings.txt', 0
iniFilePath db 'settings.ini', 0
readBuffer dd ?
bufferLength dd 1000
bytesRead dd 0
strBuffer db 256 dup (0)
arrayBuffer db 256 dup (0)

; ==== prompts ==== ;
NEXT_LINE db 13, 10, 0
Expand Down
52 changes: 52 additions & 0 deletions File/TicksPositions/Ticks.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
proc File.TicksPosition.Write
invoke CreateFile, ticksFilePath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0
mov [hTicksFile], eax
cmp eax, INVALID_HANDLE_VALUE
jne @F
stdcall File.IniFile.Error
jmp .exit
@@:

; write settings in file
stdcall File.IniFile.IntToStr, [garbgeCounter]
stdcall File.IniFile.WriteRule, GARBAGE_COUNTER_PROMPT, eax
stdcall File.IniFile.IntToStr, [isGameStart]
stdcall File.IniFile.WriteRule, IS_GAME_START_PROMPT, eax
stdcall File.IniFile.IntToStr, [currentScore]
stdcall File.IniFile.WriteRule, CURRENT_SCORE_PROMPT, eax
stdcall File.IniFile.ArrIntToStr, TICKS_MATRIX_PROMPT, TicksMatrix, 64

.exit:
invoke CloseHandle, [hTicksFile]
ret
ret
endp

proc File.TicksPosition.Read uses eax ebx ecx edx edi
invoke CreateFile, ticksFilePath, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0
mov [hTicksFile], eax
cmp eax, INVALID_HANDLE_VALUE
jne @F
stdcall File.IniFile.Error
jmp .exit
@@:
; length
invoke HeapAlloc, [hHeap], 8, [bufferLength]
mov [readBuffer], eax
invoke ReadFile, [hTicksFile], [readBuffer], [bufferLength], bytesRead, 0
cmp [bytesRead], 0
je @F
; ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ALARM ;
; !!!!!!!!!!!!!!!!!!!!!!!!!!! DO NOT TOUCH EDI !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ;
mov edi, [readBuffer]
stdcall File.IniFIle.ReadString, garbgeCounter, 1
stdcall File.IniFIle.ReadString, isGameStart, 1
stdcall File.IniFIle.ReadString, currentScore, 1
stdcall File.IniFile.StrToArrInt, TicksMatrix, 64
; !!!!!!!!!!!!!!!!!!!!! ALARM DIACTIVATE! GOOD LUCK :) !!!!!!!!!!!!!!!!!!!!!!!! ;
@@:
invoke HeapFree, [hHeap], 0, [readBuffer]
.exit:
invoke CloseHandle, [hTicksFile]
ret
endp
7 changes: 7 additions & 0 deletions File/TicksPositions/TicksPosition.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
hTicksFile dd ?
ticksFilePath db 'ticks.ini', 0

TICKS_MATRIX_PROMPT db "TICKS_MATRIX=", 0
GARBAGE_COUNTER_PROMPT db "GARBAGE_COUNTER=", 0
IS_GAME_START_PROMPT db "IS_GAME_START=", 0
CURRENT_SCORE_PROMPT db "CURRENT_SCORE=", 0
19 changes: 17 additions & 2 deletions Graphics/Animations/Animations.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Anim_GamePage dd 4,\
Anim_btn_cl, Anim_Settingsbtn_cl,\
Anim_btn_cl, Anim_Pausebtn_cl

Anim_AboutPage dd 1,\
Anim_AboutPage dd 2,\
Anim_btn_cl, Anim_Settingsbtn_cl,\
Anim_btn_cl, Anim_SubPages_cl

Anim_SReturnFont_cl dd sp_return_circle_design,\
Expand Down Expand Up @@ -105,4 +106,18 @@ Anim_HotkeysPage dd 2,\
Anim_btn_cl, Anim_HRetBtnFont_cl,\
Anim_btn_cl, Anim_HRetBtnHrst_cl

AnimsList dd Anim_LoadingPage, Anim_MainPage, Anim_GamePage, Anim_AboutPage, Anim_SettingsPage, Anim_PausePage, Anim_WinnerPage, Anim_HotkeysPage
Anim_EPYesFont_cl dd ep_yes_brdr_design,\
yes_font_color, brown_text_color, brown_color
Anim_EPYesText_cl dd ep_yes_brdr_design,\
yes_text_color, brown_color, brown_text_color
Anim_EPNoFont_cl dd ep_no_brdr_design,\
no_font_color, brown_text_color, pale_color
Anim_EPNoText_cl dd ep_no_brdr_design,\
no_text_color, pale_color, brown_text_color
Anim_ExitPage dd 4,\
Anim_btn_cl, Anim_EPYesFont_cl,\
Anim_btn_cl, Anim_EPYesText_cl,\
Anim_btn_cl, Anim_EPNoFont_cl,\
Anim_btn_cl, Anim_EPNoText_cl

AnimsList dd Anim_LoadingPage, Anim_MainPage, Anim_GamePage, Anim_AboutPage, Anim_SettingsPage, Anim_PausePage, Anim_WinnerPage, Anim_HotkeysPage, Anim_ExitPage
20 changes: 12 additions & 8 deletions Graphics/Draw/ASCII/Letters.asm
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,19 @@ proc Graphics.Draw.ASCII.Letters.CreateGLChar uses eax ecx ebx edi,\
ret
endp

proc Graphics.Draw.ASCII.Letters.GetLetterLen uses ebx,\
proc Graphics.Draw.ASCII.Letters.GetLetterLen,\
letter, multiplier
mov ebx, [letter]
stdcall Math.Absolute, [multiplier]
mov eax, [multiplier]
cmp eax, 0
jne @F
inc eax
cmp dword [ebx + 4], -1
je @F
stdcall Scripts.Getters.GetIMULNumber, [ebx + 4], [multiplier]
mov ebx, 1
jmp .exit
@@:
stdcall Scripts.Getters.GetIMULNumber, [ebx + 4], eax
ret
stdcall Scripts.Getters.GetIMULNumber, [ebx + 8], [multiplier]
mov eax, 33
mov ebx, -1
jmp .exit
.exit:
ret
endp
2 changes: 1 addition & 1 deletion Graphics/Draw/Components/PauseButton.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
proc Graphics.Draw.Components.PauseButton
stdcall Graphics.Draw.Shapes, pause_btn_fnt_design, pause_button_color
stdcall Graphics.Draw.Shapes, pause_btn_lines_design, book_title_color
stdcall Graphics.Draw.Text.Write, txt_P_hk, book_title_color
stdcall Graphics.Draw.Text.Write, [txt_P_hk], book_title_color
ret
endp
2 changes: 1 addition & 1 deletion Graphics/Draw/Components/RecoveryButton.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ proc Graphics.Draw.Components.RecoveryButton
stdcall Graphics.Draw.Shapes, recovery_btn_fntblock_design, recovery_button_color
stdcall Graphics.Draw.Shapes, recovery_btn_lftriangle_design, book_title_color
stdcall Graphics.Draw.Shapes, recovery_btn_rgtriangle_design, book_title_color
stdcall Graphics.Draw.Text.Write, txt_R_hk, book_title_color
stdcall Graphics.Draw.Text.Write, [txt_R_hk], book_title_color
ret
endp
2 changes: 1 addition & 1 deletion Graphics/Draw/Components/SettingsButton.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ proc Graphics.Draw.Components.SettingsButton
stdcall Graphics.Draw.Shapes, settings_btn_in_circle_design, settings_button_color
stdcall Graphics.Draw.Shapes, settings_btn_mainline_design, book_title_color
stdcall Graphics.Draw.Shapes, settings_btn_subline_design, book_title_color
stdcall Graphics.Draw.Text.Write, txt_S_hk, book_title_color
stdcall Graphics.Draw.Text.Write, [txt_S_hk], book_title_color
ret
endp
Loading