projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added movement-based engine snapshot mode to step-based mode
[rocksndiamonds.git]
/
src
/
files.c
diff --git
a/src/files.c
b/src/files.c
index 9d1c35ac393fe7c5372dcc4bec9515631543201f..e17322d6d114396d7f51ab1bf1e3e20ed59d0f60 100644
(file)
--- a/
src/files.c
+++ b/
src/files.c
@@
-1608,18
+1608,21
@@
static void setLevelInfoToDefaults_Level(struct LevelInfo *level)
level->encoding_16bit_yamyam = TRUE;
level->encoding_16bit_amoeba = TRUE;
level->encoding_16bit_yamyam = TRUE;
level->encoding_16bit_amoeba = TRUE;
- for (x = 0; x < MAX_LEV_FIELDX; x++)
- for (y = 0; y < MAX_LEV_FIELDY; y++)
- level->field[x][y] = EL_SAND;
-
+ /* clear level name and level author string buffers */
for (i = 0; i < MAX_LEVEL_NAME_LEN; i++)
level->name[i] = '\0';
for (i = 0; i < MAX_LEVEL_AUTHOR_LEN; i++)
level->author[i] = '\0';
for (i = 0; i < MAX_LEVEL_NAME_LEN; i++)
level->name[i] = '\0';
for (i = 0; i < MAX_LEVEL_AUTHOR_LEN; i++)
level->author[i] = '\0';
+ /* set level name and level author to default values */
strcpy(level->name, NAMELESS_LEVEL_NAME);
strcpy(level->author, ANONYMOUS_NAME);
strcpy(level->name, NAMELESS_LEVEL_NAME);
strcpy(level->author, ANONYMOUS_NAME);
+ /* set level playfield to playable default level with player and exit */
+ for (x = 0; x < MAX_LEV_FIELDX; x++)
+ for (y = 0; y < MAX_LEV_FIELDY; y++)
+ level->field[x][y] = EL_SAND;
+
level->field[0][0] = EL_PLAYER_1;
level->field[STD_LEV_FIELDX - 1][STD_LEV_FIELDY - 1] = EL_EXIT_CLOSED;
level->field[0][0] = EL_PLAYER_1;
level->field[STD_LEV_FIELDX - 1][STD_LEV_FIELDY - 1] = EL_EXIT_CLOSED;
@@
-3743,7
+3746,8
@@
static void CopyNativeTape_SP_to_RND(struct LevelInfo *level)
tape.pos[i].delay = demo_repeat + 1;
}
tape.pos[i].delay = demo_repeat + 1;
}
- tape.length_seconds = GetTapeLength();
+ tape.length_frames = GetTapeLengthFrames();
+ tape.length_seconds = GetTapeLengthSeconds();
}
}
@@
-6217,6
+6221,12
@@
static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename)
level->field[x][y] = getMappedElementByVersion(level->field[x][y],
level->game_version);
level->field[x][y] = getMappedElementByVersion(level->field[x][y],
level->game_version);
+ /* clear unused playfield data (nicer if level gets resized in editor) */
+ for (x = 0; x < MAX_LEV_FIELDX; x++)
+ for (y = 0; y < MAX_LEV_FIELDY; y++)
+ if (x >= level->fieldx || y >= level->fieldy)
+ level->field[x][y] = EL_EMPTY;
+
/* copy elements to runtime playfield array */
for (x = 0; x < MAX_LEV_FIELDX; x++)
for (y = 0; y < MAX_LEV_FIELDY; y++)
/* copy elements to runtime playfield array */
for (x = 0; x < MAX_LEV_FIELDX; x++)
for (y = 0; y < MAX_LEV_FIELDY; y++)
@@
-7430,7
+7440,8
@@
void LoadTape_SokobanSolution(char *filename)
if (tape.no_valid_file)
return;
if (tape.no_valid_file)
return;
- tape.length_seconds = GetTapeLength();
+ tape.length_frames = GetTapeLengthFrames();
+ tape.length_seconds = GetTapeLengthSeconds();
}
void LoadTapeFromFilename(char *filename)
}
void LoadTapeFromFilename(char *filename)
@@
-7572,7
+7583,8
@@
void LoadTapeFromFilename(char *filename)
closeFile(file);
closeFile(file);
- tape.length_seconds = GetTapeLength();
+ tape.length_frames = GetTapeLengthFrames();
+ tape.length_seconds = GetTapeLengthSeconds();
#if 0
printf("::: tape file version: %d\n", tape.file_version);
#if 0
printf("::: tape file version: %d\n", tape.file_version);
@@
-8425,7
+8437,6
@@
void LoadSetup()
{
char *player_name_new;
{
char *player_name_new;
- checkSetupFileHashIdentifier(setup_file_hash, filename,getCookie("SETUP"));
decodeSetupFileHash(setup_file_hash);
freeSetupFileHash(setup_file_hash);
decodeSetupFileHash(setup_file_hash);
freeSetupFileHash(setup_file_hash);
@@
-8462,7
+8473,6
@@
void LoadSetup_EditorCascade()
if (setup_file_hash)
{
if (setup_file_hash)
{
- checkSetupFileHashIdentifier(setup_file_hash, filename,getCookie("SETUP"));
decodeSetupFileHash_EditorCascade(setup_file_hash);
freeSetupFileHash(setup_file_hash);
decodeSetupFileHash_EditorCascade(setup_file_hash);
freeSetupFileHash(setup_file_hash);
@@
-8485,9
+8495,7
@@
void SaveSetup()
return;
}
return;
}
- fprintf(file, "%s\n", getFormattedSetupEntry(TOKEN_STR_FILE_IDENTIFIER,
- getCookie("SETUP")));
- fprintf(file, "\n");
+ fprintFileHeader(file, SETUP_FILENAME);
/* global setup */
si = setup;
/* global setup */
si = setup;
@@
-8560,12
+8568,9
@@
void SaveSetup_EditorCascade()
return;
}
return;
}
- fprintf(file, "%s\n", getFormattedSetupEntry(TOKEN_STR_FILE_IDENTIFIER,
- getCookie("SETUP")));
- fprintf(file, "\n");
+ fprintFileHeader(file, EDITORCASCADE_FILENAME);
seci = setup.editor_cascade;
seci = setup.editor_cascade;
- fprintf(file, "\n");
for (i = 0; i < NUM_EDITOR_CASCADE_SETUP_TOKENS; i++)
fprintf(file, "%s\n", getSetupLine(editor_cascade_setup_tokens, "", i));
for (i = 0; i < NUM_EDITOR_CASCADE_SETUP_TOKENS; i++)
fprintf(file, "%s\n", getSetupLine(editor_cascade_setup_tokens, "", i));
@@
-9760,24
+9765,27
@@
void CreateLevelSketchImages()
/* create and save images for custom and group elements (raw BMP format) */
/* ------------------------------------------------------------------------- */
/* create and save images for custom and group elements (raw BMP format) */
/* ------------------------------------------------------------------------- */
-void CreateCustomElementImages()
+void CreateCustomElementImages(
char *directory
)
{
#if defined(TARGET_SDL)
{
#if defined(TARGET_SDL)
- char *filename = "graphics.classic/RocksCE.bmp";
- Bitmap *bitmap;
+ char *src_basename = "RocksCE-template.ilbm";
+ char *dst_basename = "RocksCE.bmp";
+ char *src_filename = getPath2(directory, src_basename);
+ char *dst_filename = getPath2(directory, dst_basename);
Bitmap *src_bitmap;
Bitmap *src_bitmap;
-
int dummy_graphic = IMG_CUSTOM_99
;
+
Bitmap *bitmap
;
int yoffset_ce = 0;
int yoffset_ge = (TILEY * NUM_CUSTOM_ELEMENTS / 16);
int yoffset_ce = 0;
int yoffset_ge = (TILEY * NUM_CUSTOM_ELEMENTS / 16);
- int src_x, src_y;
int i;
int i;
+ SDLInitVideoDisplay();
+
+ src_bitmap = LoadImage(src_filename);
+
bitmap = CreateBitmap(TILEX * 16 * 2,
TILEY * (NUM_CUSTOM_ELEMENTS + NUM_GROUP_ELEMENTS) / 16,
DEFAULT_DEPTH);
bitmap = CreateBitmap(TILEX * 16 * 2,
TILEY * (NUM_CUSTOM_ELEMENTS + NUM_GROUP_ELEMENTS) / 16,
DEFAULT_DEPTH);
- getFixedGraphicSource(dummy_graphic, 0, &src_bitmap, &src_x, &src_y);
-
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
{
int x = i % 16;
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
{
int x = i % 16;
@@
-9843,8
+9851,8
@@
void CreateCustomElementImages()
}
}
}
}
- if (SDL_SaveBMP(bitmap->surface, filename) != 0)
- Error(ERR_EXIT, "cannot save CE graphics file '%s'", filename);
+ if (SDL_SaveBMP(bitmap->surface,
dst_
filename) != 0)
+ Error(ERR_EXIT, "cannot save CE graphics file '%s'",
dst_
filename);
FreeBitmap(bitmap);
FreeBitmap(bitmap);