Skip to content

Commit

Permalink
View history
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoAiresCastello committed Nov 3, 2024
1 parent d84308f commit fe80b59
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 100 deletions.
4 changes: 2 additions & 2 deletions 0.4/PTM.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ClCompile Include="src\PTML_SPRITES.cpp" />
<ClCompile Include="src\PTML_VARS.cpp" />
<ClCompile Include="src\t_record_file.cpp" />
<ClCompile Include="src\t_sound_mml.cpp" />
<ClCompile Include="src\t_sound.cpp" />
<ClCompile Include="src\t_sound_wav.cpp" />
<ClCompile Include="src\t_table.cpp" />
<ClCompile Include="src\t_char.cpp" />
Expand Down Expand Up @@ -83,7 +83,7 @@
<ClInclude Include="src\t_namespace.h" />
<ClInclude Include="src\t_record_file.h" />
<ClInclude Include="src\t_rect.h" />
<ClInclude Include="src\t_sound_mml.h" />
<ClInclude Include="src\t_sound.h" />
<ClInclude Include="src\t_sound_wav.h" />
<ClInclude Include="src\t_table.h" />
<ClInclude Include="src\t_binary.h" />
Expand Down
4 changes: 2 additions & 2 deletions 0.4/PTM.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<ClCompile Include="src\t_record_file.cpp">
<Filter>FILESYSTEM</Filter>
</ClCompile>
<ClCompile Include="src\t_sound_mml.cpp">
<ClCompile Include="src\t_sound.cpp">
<Filter>SOUND</Filter>
</ClCompile>
<ClCompile Include="src\PTML_SOUND.cpp">
Expand Down Expand Up @@ -295,7 +295,7 @@
<ClInclude Include="src\t_record_file.h">
<Filter>FILESYSTEM</Filter>
</ClInclude>
<ClInclude Include="src\t_sound_mml.h">
<ClInclude Include="src\t_sound.h">
<Filter>SOUND</Filter>
</ClInclude>
<ClInclude Include="src\PTML_SOUND.h">
Expand Down
Binary file modified 0.4/build/PTM.exe
Binary file not shown.
Binary file modified 0.4/build/ucrtbased.dll
Binary file not shown.
9 changes: 5 additions & 4 deletions 0.4/src/PTM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ t_filesystem filesys;
t_keyboard kb;
t_charset chr;
t_palette pal;
t_sound snd;
t_screen scr(256, t_window::rows - 2);

void PTM::run()
Expand All @@ -36,7 +37,7 @@ void PTM::run()
halted = false;
tilereg.set_empty();
prg.lines.clear();
sound_gen.set_volume(t_sound_mml::max_volume / 5);
snd.set_volume(10);

init();
run_main();
Expand Down Expand Up @@ -66,7 +67,7 @@ void PTM::init()

void PTM::run_main()
{
sound_gen.beep(1450, 50);
snd.alert();

bool autoexec = t_filesystem::file_exists(autoexec_file);
if (!autoexec)
Expand Down Expand Up @@ -575,7 +576,7 @@ int PTM::find_program_label(const t_string& label)
return prg.find_label(label);
}

t_sound_mml& PTM::get_sound_gen()
t_sound& PTM::get_sound()
{
return sound_gen;
return snd;
}
5 changes: 2 additions & 3 deletions 0.4/src/PTM.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "t_namespace.h"
#include "t_pointers.h"
#include "t_sprite.h"
#include "t_sound_mml.h"
#include "t_sound.h"
#include "t_screen.h"

class PTM
Expand Down Expand Up @@ -93,7 +93,7 @@ class PTM
void load_tilereg(const t_string& name);
bool has_tilereg(const t_string& name);
int find_program_label(const t_string& label);
t_sound_mml& get_sound_gen();
t_sound& get_sound();

private:
bool running = false;
Expand All @@ -104,7 +104,6 @@ class PTM
t_namespace<t_sprite_ptr> sprites;
t_namespace<t_table> tables;
t_namespace<t_tile> tile_presets;
t_sound_mml sound_gen;

void init();
void run_tests();
Expand Down
13 changes: 9 additions & 4 deletions 0.4/src/PTML_SOUND.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@

void PTML::BEEP()
{
ARGC(2);
ptm->get_sound_gen().beep(NUM(1), NUM(2));
ARGC_MIN_MAX(0, 2);
if (COUNT(0))
SOUND.alert();
else if (COUNT(2))
SOUND.beep(NUM(1), NUM(2));
else
error = err.invalid_argc;
}

void PTML::PLAY()
{
ARGC(1);
ptm->get_sound_gen().play_mml(STR(1));
SOUND.play_mml(STR(1));
}

void PTML::LPLAY()
{
ARGC(1);
ptm->get_sound_gen().play_mml_loop(STR(1));
SOUND.play_mml_loop(STR(1));
}
1 change: 1 addition & 0 deletions 0.4/src/PTML_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define EMPTY_STR ""
#define EMPTY_NUM 0
#define TILEREG ptm->tilereg
#define SOUND ptm->get_sound()
#define IF_TILEREG_EMPTY_RET if (!TILEREG.has_any_char()) { return; }
#define PRINT_LIST(x) if (scr->print_lines(x, ptm)) { scr->print_string_crlf("Break"); }
#define CHK_TBUF_BOUNDS(x, col, row) if (col < 0 || row < 0 || col > x->last_col || row > x->last_row) { error = err.arg_out_of_range; return; }
Expand Down
2 changes: 2 additions & 0 deletions 0.4/src/t_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ bool t_interpreter::execute_line(t_program_line& line)
scr->print_string_crlf(PTML::error);
else
scr->print_string_crlf(t_string::fmt("%s in %i", PTML::error.c_str(), line.line_nr));

ptm->get_sound().alert();
}

if (line.immediate)
Expand Down
4 changes: 3 additions & 1 deletion 0.4/src/t_main_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void t_main_editor::init(PTM* ptm, t_screen* scr, t_keyboard* kb, t_interpreter*
this->scr = scr;
this->kb = kb;
this->intp = intp;
this->mml = &ptm->get_sound_gen();
this->snd = &ptm->get_sound();

reset();
}
Expand Down Expand Up @@ -60,6 +60,8 @@ void t_main_editor::on_keydown()
if (!handle_function_key())
handle_character_key();

snd->keystroke();

kb->pop_key();
}

Expand Down
4 changes: 2 additions & 2 deletions 0.4/src/t_main_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class PTM;
class t_screen;
class t_keyboard;
class t_interpreter;
class t_sound_mml;
class t_sound;

class t_main_editor
{
Expand All @@ -25,7 +25,7 @@ class t_main_editor
t_screen* scr = nullptr;
t_keyboard* kb = nullptr;
t_interpreter* intp = nullptr;
t_sound_mml* mml = nullptr;
t_sound* snd = nullptr;

bool handle_control_key();
bool handle_function_key();
Expand Down
Loading

0 comments on commit fe80b59

Please sign in to comment.