From 80aa0e4b2b060112407417a9d2896395023a21cc Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 16 Sep 2013 20:55:43 +0200 Subject: [PATCH] rnd-20130916-1-src --- src/Makefile | 16 +++++++++++----- src/conftime.h | 2 +- src/editor.c | 13 ++++++++++--- src/files.c | 14 +++++++++++++- src/game.c | 14 +++++++++----- src/game_em/graphics.c | 7 ++++++- src/game_em/synchro_1.c | 13 ------------- src/game_sp/DDScrollBuffer.c | 7 ++++++- src/game_sp/DDScrollBuffer.h | 2 +- src/game_sp/Explosions.c | 13 ++++++++++++- src/init.c | 2 +- src/libgame/gadgets.c | 22 ++++++++++++++-------- src/libgame/misc.c | 4 ++-- src/libgame/sdl.c | 14 ++++++++++++-- src/libgame/setup.c | 7 +++++-- src/libgame/system.c | 4 ++++ src/network.c | 2 -- src/screens.c | 7 ++++++- src/tape.c | 6 ++++++ src/tools.c | 5 +++-- 20 files changed, 122 insertions(+), 52 deletions(-) diff --git a/src/Makefile b/src/Makefile index 646631a8..9820c4de 100644 --- a/src/Makefile +++ b/src/Makefile @@ -30,9 +30,11 @@ RANLIB = ranlib ETAGS = etags RM = rm -f -BMP2ICO = bmp2ico +CONVERT = convert WINDRES = windres +CONVERT_ICON_ARGS = -transparent black -background transparent + PROGBASE = rocksndiamonds ifdef SPECIAL_EDITION # create special edition @@ -235,13 +237,16 @@ RNDLIBS = $(LIBGAME) $(GAME_EM) $(GAME_SP) AUTOCONF = conf_gfx.h conf_snd.h conf_mus.h ICONBASE = windows_icon +ICON_BASEPATH = ../Special/Icons/windows_icons ifeq ($(PLATFORM),cross-win32) ifdef SPECIAL_EDITION -ICONSUFFIX = 32x32_$(SPECIAL_EDITION) +# ICONSUFFIX = 32x32_$(SPECIAL_EDITION) +ICON_PATH = $(ICON_BASEPATH)/$(SPECIAL_EDITION) else -ICONSUFFIX = 32x32 +# ICONSUFFIX = 32x32 +ICON_PATH = $(ICON_BASEPATH)/default endif -ICON32X32 = ../graphics/$(ICONBASE)_$(ICONSUFFIX).bmp +# ICON32X32 = ../graphics/$(ICONBASE)_$(ICONSUFFIX).bmp ICON = $(ICONBASE).o endif @@ -291,7 +296,8 @@ $(TIMESTAMP_FILE): $(SRCS) $(LIBGAME) $(GAME_EM) $(GAME_SP) > $(TIMESTAMP_FILE) $(ICON): - $(BMP2ICO) -transparent $(ICONBASE).ico $(ICON32X32) +# $(CONVERT) $(ICON32X32) $(CONVERT_ICON_ARGS) $(ICONBASE).ico + $(CONVERT) $(ICON_PATH)/*.png $(CONVERT_ICON_ARGS) $(ICONBASE).ico echo "$(ICONBASE) ICON $(ICONBASE).ico" | $(WINDRES) -o $(ICON) .c.o: diff --git a/src/conftime.h b/src/conftime.h index 1eafa161..5dbe469e 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2013-09-05 09:51" +#define COMPILE_DATE_STRING "2013-09-16 20:53" diff --git a/src/editor.c b/src/editor.c index 35ebce3f..005a1a2a 100644 --- a/src/editor.c +++ b/src/editor.c @@ -10314,7 +10314,10 @@ static void FloodFill(int from_x, int from_y, int fill_element) static int DrawLevelText(int sx, int sy, char letter, int mode) { static short delete_buffer[MAX_LEV_FIELDX]; - static int start_sx, start_sy; + static int start_sx; +#if 0 + static int start_sy; +#endif static int last_sx, last_sy; static boolean typing = FALSE; int letter_element = EL_CHAR_ASCII0 + letter; @@ -10356,8 +10359,12 @@ static int DrawLevelText(int sx, int sy, char letter, int mode) DrawLevelText(0, 0, 0, TEXT_END); typing = TRUE; - start_sx = last_sx = sx; - start_sy = last_sy = sy; + start_sx = sx; +#if 0 + start_sy = sy; +#endif + last_sx = sx; + last_sy = sy; DrawLevelText(sx, sy, 0, TEXT_SETCURSOR); break; diff --git a/src/files.c b/src/files.c index fd0c4010..21aea238 100644 --- a/src/files.c +++ b/src/files.c @@ -2584,13 +2584,21 @@ static int LoadLevel_CNT2(FILE *file, int chunk_size, struct LevelInfo *level) { int i, x, y; int element; - int num_contents, content_xsize, content_ysize; + int num_contents; +#if 0 + int content_xsize, content_ysize; +#endif int content_array[MAX_ELEMENT_CONTENTS][3][3]; element = getMappedElement(getFile16BitBE(file)); num_contents = getFile8Bit(file); +#if 1 + getFile8Bit(file); /* content x size (unused) */ + getFile8Bit(file); /* content y size (unused) */ +#else content_xsize = getFile8Bit(file); content_ysize = getFile8Bit(file); +#endif ReadUnusedBytesFromFile(file, LEVEL_CHUNK_CNT2_UNUSED); @@ -7580,10 +7588,14 @@ void LoadLevel(int nr) void LoadLevelInfoOnly(int nr) { +#if 0 char *filename; +#endif setLevelFileInfo(&level.file_info, nr); +#if 0 filename = level.file_info.filename; +#endif LoadLevelFromFileInfo(&level, &level.file_info, TRUE); } diff --git a/src/game.c b/src/game.c index 0468be7f..e16e5b1b 100644 --- a/src/game.c +++ b/src/game.c @@ -11872,7 +11872,6 @@ static void CheckSingleStepMode(struct PlayerInfo *player) static byte PlayerActions(struct PlayerInfo *player, byte player_action) { - boolean moved = FALSE, snapped = FALSE, dropped = FALSE; int left = player_action & JOY_LEFT; int right = player_action & JOY_RIGHT; int up = player_action & JOY_UP; @@ -11888,13 +11887,13 @@ static byte PlayerActions(struct PlayerInfo *player, byte player_action) if (player_action) { if (button1) - snapped = SnapField(player, dx, dy); + SnapField(player, dx, dy); else { if (button2) - dropped = DropElement(player); + DropElement(player); - moved = MovePlayer(player, dx, dy); + MovePlayer(player, dx, dy); } CheckSingleStepMode(player); @@ -15803,14 +15802,19 @@ static boolean DropElement(struct PlayerInfo *player) if (IS_CUSTOM_ELEMENT(new_element) && CAN_MOVE(new_element) && element_info[new_element].move_pattern == MV_WHEN_DROPPED) { - int move_direction, nextx, nexty; +#if 0 + int move_direction; + int nextx, nexty; +#endif if (element_info[new_element].move_direction_initial == MV_START_AUTOMATIC) MovDir[dropx][dropy] = drop_direction; +#if 0 move_direction = MovDir[dropx][dropy]; nextx = dropx + GET_DX_FROM_DIR(move_direction); nexty = dropy + GET_DY_FROM_DIR(move_direction); +#endif ChangeCount[dropx][dropy] = 0; /* allow at least one more change */ diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index ef0e1537..d7f7025a 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -201,14 +201,19 @@ void BackToFront_EM(void) boolean half_shifted_y = (EVEN(SCR_FIELDY) && screen_y % TILEY != 0); #endif - int sx, sy, sxsize, sysize; + int sx, sy; +#if 0 + int sxsize, sysize; +#endif int xsize = SXSIZE; int ysize = SYSIZE; int full_xsize = lev.width * TILEX; int full_ysize = lev.height * TILEY; +#if 0 sxsize = (full_xsize < xsize ? full_xsize : xsize); sysize = (full_ysize < ysize ? full_ysize : ysize); +#endif sx = SX + (full_xsize < xsize ? (xsize - full_xsize) / 2 : 0); sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0); diff --git a/src/game_em/synchro_1.c b/src/game_em/synchro_1.c index 3a469fdf..ef4d0f2c 100644 --- a/src/game_em/synchro_1.c +++ b/src/game_em/synchro_1.c @@ -469,7 +469,6 @@ static void check_player(struct PLAYER *ply) int oldy = ply->y; int x = oldx; int y = oldy; - int anim = 0; int dx = 0, dy = 0; game_em.last_player_direction[ply->num] = MV_NONE; @@ -485,26 +484,22 @@ static void check_player(struct PLAYER *ply) { x--; dx = -1; - anim = 3; } else if (ply->joy_e) /* east */ { x++; dx = 1; - anim = 1; } if (ply->joy_n) /* north */ { y--; dy = -1; - anim = 0; } else if (ply->joy_s) /* south */ { y++; dy = 1; - anim = 2; } #else @@ -515,25 +510,21 @@ static void check_player(struct PLAYER *ply) { y--; dy = -1; - anim = 0; } else if (ply->joy_e) /* east */ { x++; dx = 1; - anim = 1; } else if (ply->joy_s) /* south */ { y++; dy = 1; - anim = 2; } else if (ply->joy_w) /* west */ { x--; dx = -1; - anim = 3; } } else @@ -542,25 +533,21 @@ static void check_player(struct PLAYER *ply) { x--; dx = -1; - anim = 3; } else if (ply->joy_s) /* south */ { y++; dy = 1; - anim = 2; } else if (ply->joy_e) /* east */ { x++; dx = 1; - anim = 1; } else if (ply->joy_n) /* north */ { y--; dy = -1; - anim = 0; } } #endif diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 82f0d1e6..de24a921 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -457,7 +457,10 @@ void DDScrollBuffer_ScrollTowards(int X, int Y, double Step) void DDScrollBuffer_SoftScrollTo(int X, int Y, int TimeMS, int FPS) { double dx, dY; - int dT, StepCount; +#if 0 + int dT; +#endif + int StepCount; double T, tStep; int oldX, oldY, maxD; static boolean AlreadyRunning = False; @@ -481,7 +484,9 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, int TimeMS, int FPS) if (StepCount == 0) StepCount = 1; +#if 0 dT = 1000 / FPS; +#endif tStep = (double)1 / StepCount; oldX = mScrollX; oldY = mScrollY; diff --git a/src/game_sp/DDScrollBuffer.h b/src/game_sp/DDScrollBuffer.h index efff1306..83bb5c85 100644 --- a/src/game_sp/DDScrollBuffer.h +++ b/src/game_sp/DDScrollBuffer.h @@ -21,7 +21,7 @@ extern int TEST_flag; extern void InitScrollPlayfield(); -extern void UpdatePlayfield(); +extern void UpdatePlayfield(boolean); extern void RestorePlayfield(); extern void DDScrollBuffer_ScrollTo(int X, int Y); diff --git a/src/game_sp/Explosions.c b/src/game_sp/Explosions.c index 867cc273..0a73d754 100644 --- a/src/game_sp/Explosions.c +++ b/src/game_sp/Explosions.c @@ -17,7 +17,10 @@ static void subExplodeZonk(int tsi, int cx); void subAnimateExplosion(int si) { - int ax, bl, X, Y; + int ax, bl; +#if 0 + int X, Y; +#endif if (LowByte(PlayField16[si]) != fiExplosion) return; @@ -35,8 +38,10 @@ void subAnimateExplosion(int si) MovHighByte(&PlayField16[si], bl); // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +#if 0 X = GetStretchX(si); Y = GetStretchY(si); +#endif GfxGraphic[GetX(si)][GetY(si)] = aniDefaultExplosion; // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -71,8 +76,10 @@ loc_g_28D0: // explosion produces infotron MovHighByte(&PlayField16[si], bl); // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +#if 0 X = GetStretchX(si); Y = GetStretchY(si); +#endif GfxGraphic[GetX(si)][GetY(si)] = aniElectronExplosion; // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } @@ -276,15 +283,19 @@ static void subExplodeInfotron(int tsi, int cx) void subClearFieldDueToExplosion(int si) { +#if 0 int X, Y; +#endif if (LowByte(PlayField16[si]) == fiExplosion) return; PlayField16[si] = 0; // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +#if 0 X = GetStretchX(si); Y = GetStretchY(si); +#endif GfxGraphic[GetX(si)][GetY(si)] = aniSpace; // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } diff --git a/src/init.c b/src/init.c index 3eb14051..f176e13e 100644 --- a/src/init.c +++ b/src/init.c @@ -39,7 +39,7 @@ #define CONFIG_TOKEN_GLOBAL_BUSY "global.busy" #define DEBUG_PRINT_INIT_TIMESTAMPS TRUE -#define DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH 1 +#define DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH 0 static struct FontBitmapInfo font_initial[NUM_INITIAL_FONTS]; diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index cbe7482c..2113b824 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -1399,18 +1399,18 @@ boolean anyTextGadgetActive() static boolean insideSelectboxLine(struct GadgetInfo *gi, int mx, int my) { - return(gi != NULL && - gi->type & GD_TYPE_SELECTBOX && - mx >= gi->x && mx < gi->x + gi->width && - my >= gi->y && my < gi->y + gi->height); + return (gi != NULL && + gi->type & GD_TYPE_SELECTBOX && + mx >= gi->x && mx < gi->x + gi->width && + my >= gi->y && my < gi->y + gi->height); } static boolean insideSelectboxArea(struct GadgetInfo *gi, int mx, int my) { - return(gi != NULL && - gi->type & GD_TYPE_SELECTBOX && - mx >= gi->selectbox.x && mx < gi->selectbox.x + gi->selectbox.width && - my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height); + return (gi != NULL && + gi->type & GD_TYPE_SELECTBOX && + mx >= gi->selectbox.x && mx < gi->selectbox.x + gi->selectbox.width && + my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height); } void ClickOnGadget(struct GadgetInfo *gi, int button) @@ -1458,7 +1458,9 @@ boolean HandleGadgets(int mx, int my, int button) boolean gadget_dragging; boolean gadget_released; boolean gadget_released_inside; +#if 0 boolean gadget_released_inside_select_line; +#endif boolean gadget_released_inside_select_area; boolean gadget_released_off_borders; boolean changed_position = FALSE; @@ -1561,12 +1563,16 @@ boolean HandleGadgets(int mx, int my, int button) /* when handling selectbox, set additional state values */ if (gadget_released_inside && (last_gi->type & GD_TYPE_SELECTBOX)) { +#if 0 gadget_released_inside_select_line = insideSelectboxLine(last_gi, mx, my); +#endif gadget_released_inside_select_area = insideSelectboxArea(last_gi, mx, my); } else { +#if 0 gadget_released_inside_select_line = FALSE; +#endif gadget_released_inside_select_area = FALSE; } diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 7051e28e..4c94b778 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -458,7 +458,7 @@ char *getLoginName() #if defined(PLATFORM_WIN32) if (login_name == NULL) { - unsigned int buffer_size = MAX_USERNAME_LEN + 1; + unsigned long buffer_size = MAX_USERNAME_LEN + 1; login_name = checked_malloc(buffer_size); if (GetUserName(login_name, &buffer_size) == 0) @@ -487,7 +487,7 @@ char *getRealName() if (real_name == NULL) { static char buffer[MAX_USERNAME_LEN + 1]; - unsigned int buffer_size = MAX_USERNAME_LEN + 1; + unsigned long buffer_size = MAX_USERNAME_LEN + 1; if (GetUserName(buffer, &buffer_size) != 0) real_name = get_corrected_real_name(buffer); diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 4c484243..3774b320 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -1334,12 +1334,17 @@ int zoomSurfaceRGBA_scaleDownBy2(SDL_Surface *src, SDL_Surface *dst) { int x, y; tColorRGBA *sp, *csp, *dp; - int sgap, dgap; +#if 0 + int sgap; +#endif + int dgap; /* pointer setup */ sp = csp = (tColorRGBA *) src->pixels; dp = (tColorRGBA *) dst->pixels; +#if 0 sgap = src->pitch - src->w * 4; +#endif dgap = dst->pitch - dst->w * 4; for (y = 0; y < dst->h; y++) @@ -1386,7 +1391,10 @@ int zoomSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst) { int x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy; tColorRGBA *sp, *csp, *dp; - int sgap, dgap; +#if 0 + int sgap; +#endif + int dgap; /* use specialized zoom function when scaling down to exactly half size */ if (src->w == 2 * dst->w && @@ -1425,7 +1433,9 @@ int zoomSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst) /* pointer setup */ sp = csp = (tColorRGBA *) src->pixels; dp = (tColorRGBA *) dst->pixels; +#if 0 sgap = src->pitch - src->w * 4; +#endif dgap = dst->pitch - dst->w * 4; csay = say; diff --git a/src/libgame/setup.c b/src/libgame/setup.c index a2cc00ad..fe4c98ba 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -3979,7 +3979,9 @@ static void checkSeriesInfo() { static char *level_directory = NULL; DIR *dir; +#if 0 struct dirent *dir_entry; +#endif /* check for more levels besides the 'levels' field of 'levelinfo.conf' */ @@ -3991,9 +3993,11 @@ static void checkSeriesInfo() if ((dir = opendir(level_directory)) == NULL) { Error(ERR_WARN, "cannot read level directory '%s'", level_directory); + return; } +#if 0 while ((dir_entry = readdir(dir)) != NULL) /* last directory entry */ { if (strlen(dir_entry->d_name) > 4 && @@ -4008,7 +4012,6 @@ static void checkSeriesInfo() levelnum_value = atoi(levelnum_str); -#if 0 if (levelnum_value < leveldir_current->first_level) { Error(ERR_WARN, "additional level %d found", levelnum_value); @@ -4019,9 +4022,9 @@ static void checkSeriesInfo() Error(ERR_WARN, "additional level %d found", levelnum_value); leveldir_current->last_level = levelnum_value; } -#endif } } +#endif closedir(dir); } diff --git a/src/libgame/system.c b/src/libgame/system.c index 6b070a26..51e8df89 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -1180,7 +1180,9 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor, int width_4, height_4; int width_8, height_8; int width_16, height_16; +#if 0 int width_32, height_32; +#endif int new_width, new_height; /* calculate new image dimensions for normal sized image */ @@ -1211,8 +1213,10 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor, height_8 = height_1 / 8; width_16 = width_1 / 16; height_16 = height_1 / 16; +#if 0 width_32 = width_1 / 32; height_32 = height_1 / 32; +#endif UPDATE_BUSY_STATE(); diff --git a/src/network.c b/src/network.c index e5e3d859..9c149138 100644 --- a/src/network.c +++ b/src/network.c @@ -502,12 +502,10 @@ static void Handle_OP_START_PLAYING() { LevelDirTree *new_leveldir; int new_level_nr; - int dummy; unsigned int new_random_seed; char *new_leveldir_identifier; new_level_nr = (buffer[2] << 8) + buffer[3]; - dummy = (buffer[4] << 8) + buffer[5]; /* (obsolete) */ new_random_seed = (buffer[6] << 24) | (buffer[7] << 16) | (buffer[8] << 8) | (buffer[9]); new_leveldir_identifier = (char *)&buffer[10]; diff --git a/src/screens.c b/src/screens.c index 5fde5b2c..77b90603 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4635,7 +4635,10 @@ static void drawSetupValue(int pos) int ypos = MENU_SCREEN_START_YPOS + pos; int startx = mSX + xpos * 32; int starty = mSY + ypos * 32; - int font_nr, font_width, font_height; + int font_nr, font_width; +#if 0 + int font_height; +#endif int type = setup_info[pos].type; void *value = setup_info[pos].value; char *value_string = getSetupValue(type, value); @@ -4671,7 +4674,9 @@ static void drawSetupValue(int pos) starty = mSY + ypos * 32; font_nr = getSetupValueFont(type, value); font_width = getFontWidth(font_nr); +#if 0 font_height = getFontHeight(font_nr); +#endif /* downward compatibility correction for Juergen Bonhagen's menu settings */ if (setup_mode != SETUP_MODE_INPUT) diff --git a/src/tape.c b/src/tape.c index 2cc1571b..1d8a3ed0 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1188,7 +1188,9 @@ void AutoPlayTape() static int num_levels_solved = 0; static int num_tape_missing = 0; static boolean level_failed[MAX_TAPES_PER_SET]; +#if 0 static boolean tape_missing[MAX_TAPES_PER_SET]; +#endif int i; if (autoplay_initialized) @@ -1237,7 +1239,9 @@ void AutoPlayTape() for (i = 0; i < MAX_TAPES_PER_SET; i++) { level_failed[i] = FALSE; +#if 0 tape_missing[i] = FALSE; +#endif } autoplay_initialized = TRUE; @@ -1272,8 +1276,10 @@ void AutoPlayTape() if (tape.no_valid_file) { num_tape_missing++; +#if 0 if (level_nr >= 0 && level_nr < MAX_TAPES_PER_SET) tape_missing[level_nr] = TRUE; +#endif printf("(no tape)\n"); continue; diff --git a/src/tools.c b/src/tools.c index 63eee0d9..6c8e96be 100644 --- a/src/tools.c +++ b/src/tools.c @@ -8840,15 +8840,16 @@ void CheckSingleStepMode_EM(byte action[MAX_PLAYERS], int frame, boolean any_player_moving, boolean player_is_dropping) { - int i; - if (tape.single_step && tape.recording && !tape.pausing) { +#if 0 boolean active_players = FALSE; + int i; for (i = 0; i < MAX_PLAYERS; i++) if (action[i] != JOY_NO_ACTION) active_players = TRUE; +#endif // if (frame == 0) if (frame == 0 && !player_is_dropping) -- 2.34.1