Skip to content

Commit

Permalink
MegaZeux 2.80d release.
Browse files Browse the repository at this point in the history
  • Loading branch information
adelva1984 committed Aug 11, 2008
1 parent 4782ebc commit 8ab51ab
Show file tree
Hide file tree
Showing 43 changed files with 4,836 additions and 3,544 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OBJS = main.o graphics.o window.o hexchar.o event.o \

PREFIX = /usr

BIN = mzx280c.exe
BIN = mzx280d.exe

CC = gcc
CPP = g++
Expand Down
2 changes: 1 addition & 1 deletion Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OBJS = main.o graphics.o window.o hexchar.o event.o \

PREFIX = /usr

BIN = mzx280c
BIN = mzx280d

CC = gcc
CPP = g++
Expand Down
48 changes: 22 additions & 26 deletions audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "configure.h"
#include "gdm2s3m.h"
#include "fsafeopen.h"
#include "delay.h"

struct _ModPlugFile
{
Expand All @@ -53,12 +54,11 @@ const int freq_conversion = 3579364;

void audio_callback(void *userdata, Uint8 *stream, int len)
{
int i, i2, i3, offset = 0;
int i, i2, offset = 0;
Sint16 *mix_src_ptr;
Sint32 *mix_dest_ptr;
Sint32 *buffer_src_ptr;
Sint16 *buffer_dest_ptr;
Sint16 cur_sample16;
Sint32 cur_sample;
int sample_duration, end_duration;
int increment_value, increment_buffer;
Expand Down Expand Up @@ -223,7 +223,7 @@ void init_audio(config_info *conf)
SDL_AudioSpec desired_spec =
{
44100,
AUDIO_S16,
AUDIO_S16SYS,
2,
0,
buffer_size,
Expand Down Expand Up @@ -348,7 +348,21 @@ void play_sample(int freq, char *filename)

// FIXME - destroy least recently used?
if(audio.num_samples_playing >= MAX_SAMS)
return;
{
unsigned int smallest = audio.sam_timestamps[0];
int smallest_i = 0;
int i;
for(i = 1; i < MAX_SAMS; i++)
{
if(audio.sam_timestamps[i] < smallest)
{
smallest = audio.sam_timestamps[i];
smallest_i = i;
}
}

end_individual_sample(smallest_i);
}

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

// This number is pretty much obtained via experimentation. It can probably
// stand to be a little higher.

// Find a free position to put it
for(i = 0; i < 16; i++)
{
Expand All @@ -405,6 +416,7 @@ void play_sample(int freq, char *filename)
audio.sample_buffers[i] =
(Sint16 *)malloc(audio.audio_settings.size);
audio.num_samples_playing++;
audio.sam_timestamps[i] = get_ticks();
}

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

void mod_exit(void)
{

}

void mod_init(void)
{

}
// FIXME - Implement? The best route right now would be to load a module
// then mangle it so it only plays the given sample at the given frequency.

void spot_sample(int freq, int sample)
{

}

// This function will remove samples from the cache one at a time,
// starting with least-played and ending with currently-playing.
// Call it removes ONE sample unless CLEAR_ALL is set. Returns 1
// if nothing was found to deallocate (IE no further fixes possible)
int free_sam_cache(char clear_all)
{

}

void sound(int frequency, int duration)
{
audio.pc_speaker_playing = 1;
Expand Down Expand Up @@ -510,7 +506,7 @@ const int default_period = 428;
void convert_sam_to_wav(char *source_name, char *dest_name)
{
FILE *source, *dest;
int frequency, period;
int frequency;
int source_length, dest_length;

char *data;
Expand Down
1 change: 1 addition & 0 deletions audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ typedef struct
Sint32 *mix_buffer;
Sint16 *mod_buffer;
Sint16 *sample_buffers[MAX_SAMS];
Uint32 sam_timestamps[MAX_SAMS];
Uint32 repeat_timeout;
Uint32 repeat_timestamp;
Uint32 pc_speaker_on;
Expand Down
23 changes: 14 additions & 9 deletions board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Board *load_board_allocate_direct(FILE *fp, int savegame)
{
Board *cur_board = (Board *)malloc(sizeof(Board));
load_board_direct(cur_board, fp, savegame);
fread(cur_board->board_name, 25, 1, fp);

return cur_board;
}
Expand Down Expand Up @@ -182,6 +183,7 @@ void load_board_direct(Board *cur_board, FILE *fp, int savegame)

// Load board parameters
fread(cur_board->mod_playing, FILENAME_SIZE, 1, fp);
cur_board->mod_playing[FILENAME_SIZE] = 0;
cur_board->viewport_x = fgetc(fp);
cur_board->viewport_y = fgetc(fp);
cur_board->viewport_width = fgetc(fp);
Expand Down Expand Up @@ -425,12 +427,14 @@ void save_board_file(Board *cur_board, char *name)
fputs(world_version_string, board_file);
optimize_null_objects(cur_board);
save_board(cur_board, board_file, 0);
// Write name
fwrite(cur_board->board_name, 25, 1, board_file);
fclose(board_file);
}

int save_board(Board *cur_board, FILE *fp, int savegame)
{
int num_robots, num_scrolls, num_sensors, num_robots_active;
int num_robots, num_scrolls, num_sensors;
int start_location = ftell(fp);
int board_width = cur_board->board_width;
int board_height = cur_board->board_height;
Expand Down Expand Up @@ -930,14 +934,15 @@ void change_board_size(Board *src_board, int new_width, int new_height)
// Fill in any blanks
if(new_height > board_height)
{
int size_difference = new_size - board_size;

memset(level_id + board_size, 0, size_difference);
memset(level_param + board_size, 0, size_difference);
memset(level_color + board_size, 7, size_difference);
memset(level_under_id + board_size, 0, size_difference);
memset(level_under_param + board_size, 0, size_difference);
memset(level_under_color + board_size, 7, size_difference);
int offset = new_width * board_height;
int size_difference = new_size - offset;

memset(level_id + offset, 0, size_difference);
memset(level_param + offset, 0, size_difference);
memset(level_color + offset, 7, size_difference);
memset(level_under_id + offset, 0, size_difference);
memset(level_under_param + offset, 0, size_difference);
memset(level_under_color + offset, 7, size_difference);

if(overlay_mode)
{
Expand Down
84 changes: 76 additions & 8 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
+ Fixed cursor going invisible when escaping from import in the editor
+ Fixed robot editor entry when pressing OK on global info
+ Fixed lack of name for MZB import/export (any MZB's exported in prior
beta versions still won't have a name)
+ Fixed some problems with setting the mouse position
+ Fixed problem with exits not bringing you all the way to the edge if width
over 400 or height over 200
+ Fixed bug that cleared too much when increasing both width and height while
resizing the board
+ Fixed problem with 1 char shortcut commands with spaces immediately after them
+ Fixed problems with load_robot and load_bc (caused crashes and infinite loops)
+ Optmized RASM heavily (this should be most noticable when doing a lot of
external robot loading from text files)
+ Fixed inability to use absolute paths in loading a game from command line
+ Fixed lastshot/lasttouch conditions with directions not working
+ Fixed char editor in robots not going into SMZX mode when proper
+ Cleaned up source code so it passes -Wall without complaint and in the process
corrected some glaring code errors that may have corrected random problems
+ File opening broken in 2.80c, fixed
+ Implemented MZM2 saving and loading and rewrote mzm.cpp (if anything is changed
or fixed regarding MZMs, attribute it to this). MZM2s can be of larger
dimensions, smaller filesize for same amount of data, and can store robots.
+ Fixed bug that could cause MZX to crash when making new strings
+ Block operations to overlay when overlay was off caused crashes - fixed
+ Fixed a problem with sprite ccheck2 against other sprites
+ Optimized function counter lookups a bit; speed gain for all counter accesses
(especially ones that begin with certain characters such as _)
+ Fixed disassembly error with ' ' character
+ Fixed assembly error where condition extended dir (such as blocked opp seek)
was not getting compiled with the dir extension
+ Fixed editor bug where the param was not being cleared when overwriting things
by double placement
+ Fixed inability to use counters with playercolor/bulletcolor/missilecolor
+ Added ability to use counters in place of p?? in the robot editor
Note - even though this expands functionality of the editor this does not
require a version number change because the worlds will still be playable in
older MZX versions (and will display correctly in the robot editor - you simply
won't be able to correctly edit the commands)
+ Mouse correctly limited to screen edges now
+ Fixed inability to overwrite robots with pushable robots and vice-versa,
as well as scrolls with signs and vice-versa
+ Possibly fixed problem with windowing error when editing global robot (?)
+ Fixed disappearing cursor after color selection box with mouse (and other places?)
+ Fixed bug in sprite clipping that caused some to be clipped off inappropriately
+ Made board_id/board_param counters readable
+ Added bound checks for all counters using board_x/board_y/overlay_x/overlay_y
+ Removed ability to put robots, scrolls/signs, and sensors (with the put command in
Robotic)
+ Fixed potential direction corruption bug causing directions not to work
sometimes even if they display correctly in the robot editor
+ Fixed copy overlay to MZM copying to overlay too
+ Fixed a bug where debug window could display the wrong amount of robot mem
and potentially even crash MZX
+ Fixed help_menu counter not doing anything (durr)
+ Changed sprite draw order so they're drawn underneath the message bar,
debug box, and time remaining display
+ Changed put p?? in Robotic so it will put default params if available
+ Fixed a bug that could cause copies from overlay to vlayer to not end up at
the correct destination
+ Fixed a bug where c?x and cx? would not display correctly in the robot editor
+ Optimized copy blocks a bit using variable length arrays instead of malloc

August 16, 2004 - MZX 2.80c

+ Fixed issues with the commands counter not being reset
+ Color intensity now gets reset when you enter the editor
+ SAMs got cutoff sometimes now.. fixed
Expand Down Expand Up @@ -49,6 +113,9 @@
+ Lengthened size of mod name buffers
+ Fixed bug where send x y doesn't work from the global robot
+ Fixed a few bugs that could cause MZX to crash
+ Fixed a bug that prevented copyrobot "string" from working in some
situations
+ Fixed a bug allowing player duplication in board importing

August 11, 2004 - MZX 2.80b

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

August 9, 2004 - First release, MZX 2.80 BETA


12 changes: 10 additions & 2 deletions config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@
# Allow music to be sampled at higher precision. Increases CPU
# usage but increases audio quality as well.

#enable_oversampling = 0
enable_oversampling = 1

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

#resampling_mode = linear
resampling_mode = fir

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

#pc_speaker_on = 1

# Volume music plays at
#music_volume = 8

# Volume samples play at
#sample_volume = 8

### Game options ###

# Name of world file that should be loaded when MZX starts.

#startup_file = caverns.mzx

# Default save file name given when you first try to save.

#save_file = saved.sav

# Speed MZX should start at (1 through 9)

#mzx_speed = 4


Expand Down
4 changes: 2 additions & 2 deletions configure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ config_info default_options =
2048,
0,
1,
7,
7,
8,
8,
1,
1,

Expand Down
Loading

0 comments on commit 8ab51ab

Please sign in to comment.