projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added sounds files to repository
[rocksndiamonds.git]
/
src
/
files.c
diff --git
a/src/files.c
b/src/files.c
index bfa9f8160f1d6f9f88630477d8e7ca4209ed4148..94817cddef85e653cb3c5d8a15c7c63887148baf 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;
@@
-6218,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++)
@@
-9763,24
+9772,24
@@
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 *filename
)
{
#if defined(TARGET_SDL)
{
#if defined(TARGET_SDL)
- char *
filename = "graphics.classic/RocksCE.bmp
";
+ char *
src_basename = "RocksCE-template.ilbm
";
Bitmap *bitmap;
Bitmap *src_bitmap;
Bitmap *bitmap;
Bitmap *src_bitmap;
- int dummy_graphic = IMG_CUSTOM_99;
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 = LoadCustomImage(src_basename);
+
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;