Skip to content

Commit 8ab51ab

Browse files
committed
MegaZeux 2.80d release.
1 parent 4782ebc commit 8ab51ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4836
-3544
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ OBJS = main.o graphics.o window.o hexchar.o event.o \
1010

1111
PREFIX = /usr
1212

13-
BIN = mzx280c.exe
13+
BIN = mzx280d.exe
1414

1515
CC = gcc
1616
CPP = g++

Makefile.linux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ OBJS = main.o graphics.o window.o hexchar.o event.o \
1010

1111
PREFIX = /usr
1212

13-
BIN = mzx280c
13+
BIN = mzx280d
1414

1515
CC = gcc
1616
CPP = g++

audio.cpp

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "configure.h"
3838
#include "gdm2s3m.h"
3939
#include "fsafeopen.h"
40+
#include "delay.h"
4041

4142
struct _ModPlugFile
4243
{
@@ -53,12 +54,11 @@ const int freq_conversion = 3579364;
5354

5455
void audio_callback(void *userdata, Uint8 *stream, int len)
5556
{
56-
int i, i2, i3, offset = 0;
57+
int i, i2, offset = 0;
5758
Sint16 *mix_src_ptr;
5859
Sint32 *mix_dest_ptr;
5960
Sint32 *buffer_src_ptr;
6061
Sint16 *buffer_dest_ptr;
61-
Sint16 cur_sample16;
6262
Sint32 cur_sample;
6363
int sample_duration, end_duration;
6464
int increment_value, increment_buffer;
@@ -223,7 +223,7 @@ void init_audio(config_info *conf)
223223
SDL_AudioSpec desired_spec =
224224
{
225225
44100,
226-
AUDIO_S16,
226+
AUDIO_S16SYS,
227227
2,
228228
0,
229229
buffer_size,
@@ -348,7 +348,21 @@ void play_sample(int freq, char *filename)
348348

349349
// FIXME - destroy least recently used?
350350
if(audio.num_samples_playing >= MAX_SAMS)
351-
return;
351+
{
352+
unsigned int smallest = audio.sam_timestamps[0];
353+
int smallest_i = 0;
354+
int i;
355+
for(i = 1; i < MAX_SAMS; i++)
356+
{
357+
if(audio.sam_timestamps[i] < smallest)
358+
{
359+
smallest = audio.sam_timestamps[i];
360+
smallest_i = i;
361+
}
362+
}
363+
364+
end_individual_sample(smallest_i);
365+
}
352366

353367
if(extension_pos && !strcasecmp(filename + extension_pos, ".sam"))
354368
{
@@ -391,9 +405,6 @@ void play_sample(int freq, char *filename)
391405
sample_loaded->mSoundFile.Ins[1].nVolume = (256 * sound_gvol) / 8;
392406
sample_loaded->mSoundFile.Ins[2].nVolume = (256 * sound_gvol) / 8;
393407

394-
// This number is pretty much obtained via experimentation. It can probably
395-
// stand to be a little higher.
396-
397408
// Find a free position to put it
398409
for(i = 0; i < 16; i++)
399410
{
@@ -405,6 +416,7 @@ void play_sample(int freq, char *filename)
405416
audio.sample_buffers[i] =
406417
(Sint16 *)malloc(audio.audio_settings.size);
407418
audio.num_samples_playing++;
419+
audio.sam_timestamps[i] = get_ticks();
408420
}
409421

410422
free(input_buffer);
@@ -454,30 +466,14 @@ void volume_mod(int vol)
454466
audio.current_mod->mSoundFile.SetMasterVolume((vol * music_gvol / 16) + 1);
455467
}
456468

457-
void mod_exit(void)
458-
{
459-
460-
}
461-
462-
void mod_init(void)
463-
{
464-
465-
}
469+
// FIXME - Implement? The best route right now would be to load a module
470+
// then mangle it so it only plays the given sample at the given frequency.
466471

467472
void spot_sample(int freq, int sample)
468473
{
469474

470475
}
471476

472-
// This function will remove samples from the cache one at a time,
473-
// starting with least-played and ending with currently-playing.
474-
// Call it removes ONE sample unless CLEAR_ALL is set. Returns 1
475-
// if nothing was found to deallocate (IE no further fixes possible)
476-
int free_sam_cache(char clear_all)
477-
{
478-
479-
}
480-
481477
void sound(int frequency, int duration)
482478
{
483479
audio.pc_speaker_playing = 1;
@@ -510,7 +506,7 @@ const int default_period = 428;
510506
void convert_sam_to_wav(char *source_name, char *dest_name)
511507
{
512508
FILE *source, *dest;
513-
int frequency, period;
509+
int frequency;
514510
int source_length, dest_length;
515511

516512
char *data;

audio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ typedef struct
4040
Sint32 *mix_buffer;
4141
Sint16 *mod_buffer;
4242
Sint16 *sample_buffers[MAX_SAMS];
43+
Uint32 sam_timestamps[MAX_SAMS];
4344
Uint32 repeat_timeout;
4445
Uint32 repeat_timestamp;
4546
Uint32 pc_speaker_on;

board.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Board *load_board_allocate_direct(FILE *fp, int savegame)
7575
{
7676
Board *cur_board = (Board *)malloc(sizeof(Board));
7777
load_board_direct(cur_board, fp, savegame);
78+
fread(cur_board->board_name, 25, 1, fp);
7879

7980
return cur_board;
8081
}
@@ -182,6 +183,7 @@ void load_board_direct(Board *cur_board, FILE *fp, int savegame)
182183

183184
// Load board parameters
184185
fread(cur_board->mod_playing, FILENAME_SIZE, 1, fp);
186+
cur_board->mod_playing[FILENAME_SIZE] = 0;
185187
cur_board->viewport_x = fgetc(fp);
186188
cur_board->viewport_y = fgetc(fp);
187189
cur_board->viewport_width = fgetc(fp);
@@ -425,12 +427,14 @@ void save_board_file(Board *cur_board, char *name)
425427
fputs(world_version_string, board_file);
426428
optimize_null_objects(cur_board);
427429
save_board(cur_board, board_file, 0);
430+
// Write name
431+
fwrite(cur_board->board_name, 25, 1, board_file);
428432
fclose(board_file);
429433
}
430434

431435
int save_board(Board *cur_board, FILE *fp, int savegame)
432436
{
433-
int num_robots, num_scrolls, num_sensors, num_robots_active;
437+
int num_robots, num_scrolls, num_sensors;
434438
int start_location = ftell(fp);
435439
int board_width = cur_board->board_width;
436440
int board_height = cur_board->board_height;
@@ -930,14 +934,15 @@ void change_board_size(Board *src_board, int new_width, int new_height)
930934
// Fill in any blanks
931935
if(new_height > board_height)
932936
{
933-
int size_difference = new_size - board_size;
934-
935-
memset(level_id + board_size, 0, size_difference);
936-
memset(level_param + board_size, 0, size_difference);
937-
memset(level_color + board_size, 7, size_difference);
938-
memset(level_under_id + board_size, 0, size_difference);
939-
memset(level_under_param + board_size, 0, size_difference);
940-
memset(level_under_color + board_size, 7, size_difference);
937+
int offset = new_width * board_height;
938+
int size_difference = new_size - offset;
939+
940+
memset(level_id + offset, 0, size_difference);
941+
memset(level_param + offset, 0, size_difference);
942+
memset(level_color + offset, 7, size_difference);
943+
memset(level_under_id + offset, 0, size_difference);
944+
memset(level_under_param + offset, 0, size_difference);
945+
memset(level_under_color + offset, 7, size_difference);
941946

942947
if(overlay_mode)
943948
{

changelog.txt

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,67 @@
1+
+ Fixed cursor going invisible when escaping from import in the editor
2+
+ Fixed robot editor entry when pressing OK on global info
3+
+ Fixed lack of name for MZB import/export (any MZB's exported in prior
4+
beta versions still won't have a name)
5+
+ Fixed some problems with setting the mouse position
6+
+ Fixed problem with exits not bringing you all the way to the edge if width
7+
over 400 or height over 200
8+
+ Fixed bug that cleared too much when increasing both width and height while
9+
resizing the board
10+
+ Fixed problem with 1 char shortcut commands with spaces immediately after them
11+
+ Fixed problems with load_robot and load_bc (caused crashes and infinite loops)
12+
+ Optmized RASM heavily (this should be most noticable when doing a lot of
13+
external robot loading from text files)
14+
+ Fixed inability to use absolute paths in loading a game from command line
15+
+ Fixed lastshot/lasttouch conditions with directions not working
16+
+ Fixed char editor in robots not going into SMZX mode when proper
17+
+ Cleaned up source code so it passes -Wall without complaint and in the process
18+
corrected some glaring code errors that may have corrected random problems
19+
+ File opening broken in 2.80c, fixed
20+
+ Implemented MZM2 saving and loading and rewrote mzm.cpp (if anything is changed
21+
or fixed regarding MZMs, attribute it to this). MZM2s can be of larger
22+
dimensions, smaller filesize for same amount of data, and can store robots.
23+
+ Fixed bug that could cause MZX to crash when making new strings
24+
+ Block operations to overlay when overlay was off caused crashes - fixed
25+
+ Fixed a problem with sprite ccheck2 against other sprites
26+
+ Optimized function counter lookups a bit; speed gain for all counter accesses
27+
(especially ones that begin with certain characters such as _)
28+
+ Fixed disassembly error with ' ' character
29+
+ Fixed assembly error where condition extended dir (such as blocked opp seek)
30+
was not getting compiled with the dir extension
31+
+ Fixed editor bug where the param was not being cleared when overwriting things
32+
by double placement
33+
+ Fixed inability to use counters with playercolor/bulletcolor/missilecolor
34+
+ Added ability to use counters in place of p?? in the robot editor
35+
Note - even though this expands functionality of the editor this does not
36+
require a version number change because the worlds will still be playable in
37+
older MZX versions (and will display correctly in the robot editor - you simply
38+
won't be able to correctly edit the commands)
39+
+ Mouse correctly limited to screen edges now
40+
+ Fixed inability to overwrite robots with pushable robots and vice-versa,
41+
as well as scrolls with signs and vice-versa
42+
+ Possibly fixed problem with windowing error when editing global robot (?)
43+
+ Fixed disappearing cursor after color selection box with mouse (and other places?)
44+
+ Fixed bug in sprite clipping that caused some to be clipped off inappropriately
45+
+ Made board_id/board_param counters readable
46+
+ Added bound checks for all counters using board_x/board_y/overlay_x/overlay_y
47+
+ Removed ability to put robots, scrolls/signs, and sensors (with the put command in
48+
Robotic)
49+
+ Fixed potential direction corruption bug causing directions not to work
50+
sometimes even if they display correctly in the robot editor
51+
+ Fixed copy overlay to MZM copying to overlay too
52+
+ Fixed a bug where debug window could display the wrong amount of robot mem
53+
and potentially even crash MZX
54+
+ Fixed help_menu counter not doing anything (durr)
55+
+ Changed sprite draw order so they're drawn underneath the message bar,
56+
debug box, and time remaining display
57+
+ Changed put p?? in Robotic so it will put default params if available
58+
+ Fixed a bug that could cause copies from overlay to vlayer to not end up at
59+
the correct destination
60+
+ Fixed a bug where c?x and cx? would not display correctly in the robot editor
61+
+ Optimized copy blocks a bit using variable length arrays instead of malloc
62+
63+
August 16, 2004 - MZX 2.80c
64+
165
+ Fixed issues with the commands counter not being reset
266
+ Color intensity now gets reset when you enter the editor
367
+ SAMs got cutoff sometimes now.. fixed
@@ -49,6 +113,9 @@
49113
+ Lengthened size of mod name buffers
50114
+ Fixed bug where send x y doesn't work from the global robot
51115
+ Fixed a few bugs that could cause MZX to crash
116+
+ Fixed a bug that prevented copyrobot "string" from working in some
117+
situations
118+
+ Fixed a bug allowing player duplication in board importing
52119

53120
August 11, 2004 - MZX 2.80b
54121

@@ -64,28 +131,28 @@ August 11, 2004 - MZX 2.80b
64131
+ The player and pushable robots can now be pushed by the push command
65132
+ Fixed bug where you could clone the player by switching boards
66133
+ Fixed bug where you could either turn off overlay or switch to boards
67-
that don't have it while in overlay edit mode...
134+
that don't have it while in overlay edit mode...
68135
+ Fixed bug where remains of debug window would not be cleared in editor
69-
if the board width is too small
136+
if the board width is too small
70137
+ Fixed bug where turning off the menu with a board too small would mess
71-
things up
138+
things up
72139
+ Fixed bug where run lengths were saved one too large... this could fix
73-
stability problems in at least occasional cases (with saved worlds or
74-
save games, at least)
140+
stability problems in at least occasional cases (with saved worlds or
141+
save games, at least)
75142
+ Fixed placing solid things beneath robots (like bombs)
76143
+ Added support for a keyboard plus in the char editors
77144
+ Fixed previous button in SFX editor
78145
+ Made robot name box disappear when robot char box comes up...
79146
+ Fixed bug where mods restart after pressing P if they're the same mod
80-
as what was playing before
147+
as what was playing before
81148
+ Fixed problem with changing params (with P) in the editor.
82149
+ Fixed bug where null boards were not being pruned from old worlds upon
83-
load
150+
load
84151
+ Made file name saving box larger (for saving games and worlds)
85152
+ Fixed bug where default (100%) palette intensity values would not be
86153
applied to the palette a game loads with
87154
+ Fixed bug where exporting char sets that are full size caused a 0
88-
byte charset to be exported (8bit wraparound)
155+
byte charset to be exported (8bit wraparound)
89156
- Removed export text in the board editor. Don't think anyone wanted it...
90157
+ Added support for forms such as :line
91158
+ Fixed sporadic incompletion of strings without trailing quotes at the
@@ -116,3 +183,4 @@ August 11, 2004 - MZX 2.80b
116183

117184
August 9, 2004 - First release, MZX 2.80 BETA
118185

186+

config.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@
5656
# Allow music to be sampled at higher precision. Increases CPU
5757
# usage but increases audio quality as well.
5858

59-
#enable_oversampling = 0
59+
enable_oversampling = 1
6060

6161
# Set resampling mode. Choices are:
6262
# none (fastest, poor quality)
6363
# linear (fast, good quality)
6464
# cubic (slow, great quality)
6565
# fir (very slow, excellent quality)
6666

67-
#resampling_mode = linear
67+
resampling_mode = fir
6868

6969
# Whether music/samples should be played or not.
7070
# Does not include PC speaker effects.
@@ -75,16 +75,24 @@
7575

7676
#pc_speaker_on = 1
7777

78+
# Volume music plays at
79+
#music_volume = 8
80+
81+
# Volume samples play at
82+
#sample_volume = 8
7883

7984
### Game options ###
8085

8186
# Name of world file that should be loaded when MZX starts.
87+
8288
#startup_file = caverns.mzx
8389

8490
# Default save file name given when you first try to save.
91+
8592
#save_file = saved.sav
8693

8794
# Speed MZX should start at (1 through 9)
95+
8896
#mzx_speed = 4
8997

9098

configure.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ config_info default_options =
363363
2048,
364364
0,
365365
1,
366-
7,
367-
7,
366+
8,
367+
8,
368368
1,
369369
1,
370370

0 commit comments

Comments
 (0)