Skip to content

Commit 75617b7

Browse files
committed
MegaZeux 2.80b release.
1 parent f9d5114 commit 75617b7

28 files changed

+790
-353
lines changed

COPYING.DOC

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Version 2, June 1991
33

44
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5-
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5+
59 Temple Place - Suite 330, Boston, MA
6+
02111-1307, USA.
67
Everyone is permitted to copy and distribute verbatim copies
78
of this license document, but changing it is not allowed.
89

@@ -279,7 +280,7 @@ POSSIBILITY OF SUCH DAMAGES.
279280

280281
END OF TERMS AND CONDITIONS
281282

282-
How to Apply These Terms to Your New Programs
283+
Appendix: How to Apply These Terms to Your New Programs
283284

284285
If you develop a new program, and you want it to be of the greatest
285286
possible use to the public, the best way to achieve this is to make it
@@ -291,7 +292,7 @@ convey the exclusion of warranty; and each file should have at least
291292
the "copyright" line and a pointer to where the full notice is found.
292293

293294
<one line to give the program's name and a brief idea of what it does.>
294-
Copyright (C) <year> <name of author>
295+
Copyright (C) 19yy <name of author>
295296

296297
This program is free software; you can redistribute it and/or modify
297298
it under the terms of the GNU General Public License as published by
@@ -305,15 +306,14 @@ the "copyright" line and a pointer to where the full notice is found.
305306

306307
You should have received a copy of the GNU General Public License
307308
along with this program; if not, write to the Free Software
308-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
309-
309+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
310310

311311
Also add information on how to contact you by electronic and paper mail.
312312

313313
If the program is interactive, make it output a short notice like this
314314
when it starts in an interactive mode:
315315

316-
Gnomovision version 69, Copyright (C) year name of author
316+
Gnomovision version 69, Copyright (C) 19yy name of author
317317
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318318
This is free software, and you are welcome to redistribute it
319319
under certain conditions; type `show c' for details.
@@ -338,5 +338,3 @@ proprietary programs. If your program is a subroutine library, you may
338338
consider it more useful to permit linking proprietary applications with the
339339
library. If this is what you want to do, use the GNU Library General
340340
Public License instead of this License.
341-
342-

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 = mzx280.exe
13+
BIN = mzx280b.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 = mzx280
13+
BIN = mzx280b
1414

1515
CC = gcc
1616
CPP = g++

audio.cpp

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <math.h>
2626
#include <stdlib.h>
27+
#include <string.h>
2728
#include <sys/stat.h>
2829

2930
#include "audio.h"
@@ -70,8 +71,9 @@ void audio_callback(void *userdata, Uint8 *stream, int len)
7071
{
7172
// Reset position
7273
audio.current_mod->mSoundFile.SetCurrentPos(0);
73-
// Zero out remainder bytes
74-
memset(audio.mod_buffer + read_len, 0, len - read_len);
74+
// Read anew remaining bytes
75+
ModPlug_Read(audio.current_mod, audio.mod_buffer + read_len,
76+
len - read_len);
7577
}
7678
}
7779
else
@@ -311,11 +313,7 @@ void play_sample(int freq, char *filename)
311313

312314
// FIXME - destroy least recently used?
313315
if(audio.num_samples_playing >= MAX_SAMS)
314-
{
315-
// Out of samples, so destroy a random existing one.
316-
int r = rand() % 16;
317-
end_individual_sample(r);
318-
}
316+
return;
319317

320318
if((extension_pos >= 0) && !strcasecmp(filename + extension_pos, ".sam"))
321319
{
@@ -346,11 +344,32 @@ void play_sample(int freq, char *filename)
346344

347345
if(sample_loaded)
348346
{
347+
int sample_length = sample_loaded->mSoundFile.Ins[1].nLength;
348+
349349
// A little hack to modify the pitch
350350
sample_loaded->mSoundFile.Ins[1].nC4Speed = (freq_conversion / freq) / 2;
351351
sample_loaded->mSoundFile.Ins[2].nC4Speed = (freq_conversion / freq) / 2;
352352
sample_loaded->mSoundFile.Ins[1].nVolume = (256 * sound_gvol) / 8;
353353
sample_loaded->mSoundFile.Ins[2].nVolume = (256 * sound_gvol) / 8;
354+
355+
// This number is pretty much obtained via experimentation. It can probably
356+
// stand to be a little higher.
357+
sample_length /= 110;
358+
359+
if(sample_length < 256)
360+
{
361+
sample_loaded->mSoundFile.Patterns[0][0].param = sample_length;
362+
sample_loaded->mSoundFile.Patterns[0][2].command = CMD_PATTERNBREAK;
363+
}
364+
else
365+
{
366+
int row_duration = sample_length / 255;
367+
sample_loaded->mSoundFile.Patterns[0][0].param = 255;
368+
if(row_duration < 62)
369+
sample_loaded->mSoundFile.Patterns[0][2 + row_duration].command =
370+
CMD_PATTERNBREAK;
371+
}
372+
354373
// Find a free position to put it
355374
for(i = 0; i < 16; i++)
356375
{
@@ -365,6 +384,7 @@ void play_sample(int freq, char *filename)
365384
}
366385

367386
free(input_buffer);
387+
fclose(input_file);
368388
}
369389
}
370390

block.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,25 +206,24 @@ char col2ansi[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
206206

207207
char exdi_types[3] = { DE_RADIO, DE_BUTTON, DE_BUTTON };
208208
char exdi_xs[3] = { 2, 5, 15 };
209-
char exdi_ys[3] = { 3, 9, 9 };
209+
char exdi_ys[3] = { 3, 8, 8 };
210210

211211
char *exdi_strs[3] =
212212
{
213213
"Board file (MZB)\n"
214214
"Character set (CHR)\n"
215-
"Text file (TXT)\n"
216215
"Palette (PAL)\n"
217216
"Sound effects (SFX)",
218217
"OK", "Cancel"
219218
};
220219

221-
int exdi_p1s[3] = { 5, 0, -1 };
220+
int exdi_p1s[3] = { 4, 0, -1 };
222221
int exdi_p2s[1] = { 19 };
223222
void *exdi_storage[1] = { NULL };
224223

225224
dialog exdi =
226225
{
227-
26, 4, 53, 15, "Export as:", 3, exdi_types, exdi_xs, exdi_ys,
226+
26, 5, 53, 15, "Export as:", 3, exdi_types, exdi_xs, exdi_ys,
228227
exdi_strs, exdi_p1s, exdi_p2s, exdi_storage, 0
229228
};
230229

board.cpp

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ Board *load_board_allocate(FILE *fp, int savegame)
6262
Board *cur_board = (Board *)malloc(sizeof(Board));
6363
load_board(cur_board, fp, savegame);
6464

65+
if(!cur_board->board_width)
66+
{
67+
free(cur_board);
68+
return NULL;
69+
}
70+
6571
return cur_board;
6672
}
6773

@@ -79,6 +85,7 @@ Board *load_board_allocate_direct(FILE *fp, int savegame)
7985
void load_board(Board *cur_board, FILE *fp, int savegame)
8086
{
8187
int board_size = fgetd(fp);
88+
8289
if(board_size)
8390
{
8491
int board_location, last_location;
@@ -92,7 +99,7 @@ void load_board(Board *cur_board, FILE *fp, int savegame)
9299
}
93100
else
94101
{
95-
memset(cur_board, 0, sizeof(Board));
102+
cur_board->board_width = 0;
96103
// And skip board location
97104
fseek(fp, 4, SEEK_CUR);
98105
}
@@ -108,24 +115,35 @@ void load_board_direct(Board *cur_board, FILE *fp, int savegame)
108115
Scroll *cur_scroll;
109116
Sensor *cur_sensor;
110117

118+
char *test_buffer;
119+
111120
board_mode = fgetc(fp);
112121

113122
overlay_mode = fgetc(fp);
114123

115124
if(!overlay_mode)
116125
{
126+
int overlay_width;
127+
int overlay_height;
128+
117129
overlay_mode = fgetc(fp);
118-
int overlay_width = fgetw(fp);
119-
int overlay_height = fgetw(fp);
130+
overlay_width = fgetw(fp);
131+
overlay_height = fgetw(fp);
132+
120133
size = overlay_width * overlay_height;
121134

122135
cur_board->overlay = (char *)malloc(size);
123136
cur_board->overlay_color = (char *)malloc(size);
124137

125138
load_RLE2_plane(cur_board->overlay, fp, size);
139+
test_buffer = (char *)malloc(1024);
140+
free(test_buffer);
141+
126142
// Skip sizes
127143
fseek(fp, 4, SEEK_CUR);
128-
load_RLE2_plane(cur_board->overlay_color, fp, size);
144+
load_RLE2_plane(cur_board->overlay_color, fp, size);
145+
test_buffer = (char *)malloc(1024);
146+
free(test_buffer);
129147
}
130148
else
131149
{
@@ -579,12 +597,14 @@ void save_RLE2_plane(char *plane, FILE *fp, int size)
579597
{
580598
current_char = plane[i];
581599
runsize = 1;
600+
582601
while((plane[i + 1] == current_char) && (runsize < 127) &&
583-
(i < size))
602+
(i < (size - 1)))
584603
{
585604
i++;
586605
runsize++;
587606
}
607+
588608
// Put the runsize if necessary
589609
if((runsize > 1) || current_char & 0x80)
590610
{
@@ -617,7 +637,7 @@ void clear_board(Board *cur_board)
617637
free(cur_board->level_under_id);
618638
free(cur_board->level_under_param);
619639
free(cur_board->level_under_color);
620-
640+
621641
if(cur_board->overlay_mode)
622642
{
623643
free(cur_board->overlay);

changelog.txt

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
August 11, 2004 - MZX 2.80b
2+
3+
+ Made it possible for robots to move through teleporters
4+
+ Fixed bug with pressing shift in text entry boxes
5+
+ Made it so alt + tab does not switch draw modes in editor
6+
+ Fixed a disassembly error for color intensity N percent command
7+
+ Fixed problem with looping on mods that do not loop explicitely
8+
+ Fixed alt + dir scrolling in the char editor
9+
+ Fixed not being able to click the rightmost char in the char editor
10+
+ Readded unmark (alt + u) to robot editor (mysteriously disappeared??)
11+
+ Fixed key label so it returns proper unicode values
12+
+ The player and pushable robots can now be pushed by the push command
13+
+ Fixed bug where you could clone the player by switching boards
14+
+ Fixed bug where you could either turn off overlay or switch to boards
15+
that don't have it while in overlay edit mode...
16+
+ Fixed bug where remains of debug window would not be cleared in editor
17+
if the board width is too small
18+
+ Fixed bug where turning off the menu with a board too small would mess
19+
things up
20+
+ Fixed bug where run lengths were saved one too large... this could fix
21+
stability problems in at least occasional cases (with saved worlds or
22+
save games, at least)
23+
+ Fixed placing solid things beneath robots (like bombs)
24+
+ Added support for a keyboard plus in the char editors
25+
+ Fixed previous button in SFX editor
26+
+ Made robot name box disappear when robot char box comes up...
27+
+ Fixed bug where mods restart after pressing P if they're the same mod
28+
as what was playing before
29+
+ Fixed problem with changing params (with P) in the editor.
30+
+ Fixed bug where null boards were not being pruned from old worlds upon
31+
load
32+
+ Made file name saving box larger (for saving games and worlds)
33+
+ Fixed bug where default (100%) palette intensity values would not be
34+
applied to the palette a game loads with
35+
+ Fixed bug where exporting char sets that are full size caused a 0
36+
byte charset to be exported (8bit wraparound)
37+
- Removed export text in the board editor. Don't think anyone wanted it...
38+
+ Added support for forms such as :line
39+
+ Fixed sporadic incompletion of strings without trailing quotes at the
40+
end of the line
41+
+ Fixed bug where clearing/cutting the last line of a robot crashed MZX
42+
+ F4 in robot editor now works more generally
43+
+ Made line numbers in robot editor error report start at 1
44+
+ Added ctrl + G to go to a line in the robot editor (ala nano)
45+
+ Made it possible to change a robot's color in the editor
46+
+ Fixed bug where spitfire, seekers, and missiles didn't hurt something
47+
immediate adjacent to whatever shot it
48+
+ Fixed editing of spitfires
49+
+ Made default speed 4 again (5, bleh)
50+
+ Readded quicksave/quickload
51+
+ Readded F8 clear (always works - be careful)
52+
+ Fixed autorepeat problems for spacepressed/delpressed.
53+
+ Wrapped around sprite values so LogiCow's bad code would work (HTMCIAB)
54+
+ Cleared block commands inbetween board changing and other things like
55+
that
56+
+ Fixed bug where MZX would crash if put dir player overwrote the robot
57+
doing it
58+
+ Fixed bug where playing SAMs would eventually crash MZX
59+
+ Fixed some mod * problems (hopefully?)
60+
+ Fixed bug where pasting blocks over the edge of the board in the editor
61+
would cause MZX to crash
62+
+ Uses new GDM2S3M source that fixes some bugs. If your converted GDM's
63+
have problems, delete the S3M's it generated.
64+
65+
August 9, 2004 - First release, MZX 2.80 BETA
66+

0 commit comments

Comments
 (0)