From: Holger Schemel Date: Sun, 20 Dec 1998 23:25:51 +0000 (+0100) Subject: rnd-19981221-1 X-Git-Tag: 1.3.0^2~48 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=020210607f2ba71676882d52d0413f4128858b4a;p=rocksndiamonds.git rnd-19981221-1 --- diff --git a/src/editor.c b/src/editor.c index a18b3976..f1536aae 100644 --- a/src/editor.c +++ b/src/editor.c @@ -71,12 +71,14 @@ #define ED_NUM_CTRL2_BUTTONS (ED_CTRL2_BUTTONS_HORIZ * ED_CTRL2_BUTTONS_VERT) #define ED_NUM_CTRL_BUTTONS (ED_NUM_CTRL1_BUTTONS + ED_NUM_CTRL2_BUTTONS) +/* values for properties window */ +#define ED_PROPERTIES_XPOS (TILEX - MINI_TILEX/2) /* values for counter gadgets */ #define ED_COUNT_VALUE_XOFFSET 5 #define ED_COUNT_VALUE_YOFFSET 3 -#define ED_COUNT_SCORE_XPOS (TILEX) +#define ED_COUNT_SCORE_XPOS ED_PROPERTIES_XPOS #define ED_COUNT_SCORE_YPOS (14 * MINI_TILEY) -#define ED_COUNT_ELEMCONT_XPOS (TILEX) +#define ED_COUNT_ELEMCONT_XPOS ED_PROPERTIES_XPOS #define ED_COUNT_ELEMCONT_YPOS (17 * MINI_TILEY) /* values for element content drawing areas */ @@ -1197,12 +1199,12 @@ void LevelEd(int mx, int my, int button) el2gfx(new_element3)); redraw_mask |= REDRAW_DOOR_1; - /* - properties_element = new_element; - if (edit_mode == ED_MODE_PROPERTIES) - DrawPropertiesWindow(); - */ - + if (!HAS_CONTENT(properties_element)) + { + properties_element = new_element; + if (edit_mode == ED_MODE_PROPERTIES) + DrawPropertiesWindow(); + } } if (edit_mode == ED_MODE_DRAWING) /********** EDIT-FENSTER **********/ @@ -1766,12 +1768,6 @@ static void DrawCounterValueField(int counter_id, int value) int2str(value, 3), FS_SMALL, FC_YELLOW); } -#define TEXT_COLLECTING "Score for collecting" -#define TEXT_SMASHING "Score for smashing" -#define TEXT_CRACKING "Score for cracking" -#define TEXT_SPEED "Speed of growth" -#define TEXT_DURATION "Duration when activated" - static void DrawDrawingWindow() { ClearWindow(); @@ -1783,7 +1779,7 @@ static void DrawDrawingWindow() static void DrawElementContentAreas() { - static int num_areas = MAX_ELEMCONT; + int *num_areas = &MampferMax; int area_x = ED_AREA_ELEMCONT_XPOS / MINI_TILEX; int area_y = ED_AREA_ELEMCONT_YPOS / MINI_TILEY; int area_sx = SX + ED_AREA_ELEMCONT_XPOS; @@ -1793,14 +1789,13 @@ static void DrawElementContentAreas() for (i=0; icustom_id; boolean inside_drawing_area = !gi->event.off_borders; boolean button_press_event; boolean button_release_event; - boolean draw_level = (gi->custom_id == ED_CTRL_ID_DRAWING_LEVEL); + boolean draw_level = (id == ED_CTRL_ID_DRAWING_LEVEL); int new_element; int button = gi->event.button; int sx = gi->event.x, sy = gi->event.y; @@ -2467,6 +2482,12 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) gi->x + sx * MINI_TILEX, gi->y + sy * MINI_TILEY, el2gfx(new_element)); + + if (id == ED_CTRL_ID_AMOEBA_CONTENT) + level.amoebe_inhalt = new_element; + else if (id >= ED_CTRL_ID_ELEMCONT_0 && id <= ED_CTRL_ID_ELEMCONT_7) + level.mampfer_inhalt[id - ED_CTRL_ID_ELEMCONT_0][sx][sy] = + new_element; } break; @@ -2726,8 +2747,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) } else { - AdjustLevelScrollPosition(); - DrawMiniLevel(level_xpos, level_ypos); + DrawDrawingWindow(); edit_mode = ED_MODE_DRAWING; } break; @@ -2753,7 +2773,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) if (Feld[x][y] != Ur[x][y]) level_changed = TRUE; - if (!level_changed) + if (0 && !level_changed) { Request("Level has not changed !", REQ_CONFIRM); break; diff --git a/src/files.c b/src/files.c index 21309b82..eb87f87e 100644 --- a/src/files.c +++ b/src/files.c @@ -258,7 +258,8 @@ static void setLevelInfoToDefaults() for(i=0; i= FILE_VERSION_1_2) { - /* next check body chunk identifier and chunk length */ fgets(chunk, CHUNK_ID_LEN + 1, file); chunk_length = (fgetc(file)<<24) | (fgetc(file)<<16) | (fgetc(file)<<8) | fgetc(file); + + /* look for optional content chunk */ + if (strcmp(chunk, "CONT") == 0 && chunk_length == 4 + 8 * 3 * 3) + { + fgetc(file); + MampferMax = fgetc(file); + fgetc(file); + fgetc(file); + + for(i=0; i<8; i++) + for(y=0; y<3; y++) + for(x=0; x<3; x++) + level.mampfer_inhalt[i][x][y] = fgetc(file); + + fgets(chunk, CHUNK_ID_LEN + 1, file); + chunk_length = + (fgetc(file)<<24) | (fgetc(file)<<16) | (fgetc(file)<<8) | fgetc(file); + } + + /* next check body chunk identifier and chunk length */ if (strcmp(chunk, "BODY") || chunk_length != lev_fieldx * lev_fieldy) { Error(ERR_WARN, "wrong 'BODY' chunk of level file '%s'", filename); @@ -415,6 +445,25 @@ void SaveLevel(int level_nr) for(i=0; i> 24) & 0xff, file); + fputc((chunk_length >> 16) & 0xff, file); + fputc((chunk_length >> 8) & 0xff, file); + fputc((chunk_length >> 0) & 0xff, file); + + fputc(EL_MAMPFER, file); + fputc(MampferMax, file); + fputc(0, file); + fputc(0, file); + + for(i=0; i<8; i++) + for(y=0; y<3; y++) + for(x=0; x<3; x++) + fputc(level.mampfer_inhalt[i][x][y], file); + fputs("BODY", file); /* chunk identifier for file body */ chunk_length = lev_fieldx * lev_fieldy; diff --git a/src/game.c b/src/game.c index 9897b56d..682c4516 100644 --- a/src/game.c +++ b/src/game.c @@ -1053,7 +1053,7 @@ void Explode(int ex, int ey, int phase, int mode) } if (center_element == EL_MAMPFER) - MampferNr = (MampferNr+1) % 4; + MampferNr = (MampferNr + 1) % MampferMax; return; } diff --git a/src/init.c b/src/init.c index f2e48bf0..6527025d 100644 --- a/src/init.c +++ b/src/init.c @@ -1245,6 +1245,16 @@ void InitElementProperties() }; static int ep_player_num = sizeof(ep_player)/sizeof(int); + static int ep_has_content[] = + { + EL_MAMPFER, + EL_AMOEBE_NASS, + EL_AMOEBE_NORM, + EL_AMOEBE_VOLL, + EL_AMOEBE_BD + }; + static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int); + static long ep_bit[] = { EP_BIT_AMOEBALIVE, @@ -1271,7 +1281,8 @@ void InitElementProperties() EP_BIT_EXPLOSIVE, EP_BIT_MAMPF3, EP_BIT_PUSHABLE, - EP_BIT_PLAYER + EP_BIT_PLAYER, + EP_BIT_HAS_CONTENT }; static int *ep_array[] = { @@ -1299,7 +1310,8 @@ void InitElementProperties() ep_explosive, ep_mampf3, ep_pushable, - ep_player + ep_player, + ep_has_content }; static int *ep_num[] = { @@ -1327,7 +1339,8 @@ void InitElementProperties() &ep_explosive_num, &ep_mampf3_num, &ep_pushable_num, - &ep_player_num + &ep_player_num, + &ep_has_content_num }; static int num_properties = sizeof(ep_num)/sizeof(int *); diff --git a/src/main.c b/src/main.c index 21f165a9..1ee567d0 100644 --- a/src/main.c +++ b/src/main.c @@ -96,7 +96,7 @@ int BX1 = 0, BY1 = 0, BX2 = SCR_FIELDX-1, BY2 = SCR_FIELDY-1; int ZX,ZY, ExitX,ExitY; int AllPlayersGone; int FrameCounter, TimeFrames, TimeLeft; -int MampferNr, SiebAktiv; +int MampferMax, MampferNr, SiebAktiv; boolean network_player_action_received = FALSE; diff --git a/src/main.h b/src/main.h index 7cdf619a..9175e5c2 100644 --- a/src/main.h +++ b/src/main.h @@ -122,6 +122,7 @@ typedef unsigned char byte; #define EP_BIT_MAMPF3 (1<<23) #define EP_BIT_PUSHABLE (1<<24) #define EP_BIT_PLAYER (1<<25) +#define EP_BIT_HAS_CONTENT (1<<26) #define IS_AMOEBALIVE(e) (Elementeigenschaften[e] & EP_BIT_AMOEBALIVE) #define IS_AMOEBOID(e) (Elementeigenschaften[e] & EP_BIT_AMOEBOID) @@ -149,6 +150,7 @@ typedef unsigned char byte; #define IS_MAMPF3(e) (Elementeigenschaften[e] & EP_BIT_MAMPF3) #define IS_PUSHABLE(e) (Elementeigenschaften[e] & EP_BIT_PUSHABLE) #define ELEM_IS_PLAYER(e) (Elementeigenschaften[e] & EP_BIT_PLAYER) +#define HAS_CONTENT(e) (Elementeigenschaften[e] & EP_BIT_HAS_CONTENT) #define IS_PLAYER(x,y) (ELEM_IS_PLAYER(StorePlayer[x][y])) @@ -329,7 +331,7 @@ struct LevelInfo int edelsteine; char name[MAX_LEVNAMLEN]; int score[LEVEL_SCORE_ELEMENTS]; - int mampfer_inhalt[4][3][3]; + int mampfer_inhalt[8][3][3]; int tempo_amoebe; int dauer_sieb; int dauer_ablenk; @@ -432,7 +434,7 @@ extern int BX1,BY1, BX2,BY2; extern int ZX,ZY, ExitX,ExitY; extern int AllPlayersGone; extern int FrameCounter, TimeFrames, TimeLeft; -extern int MampferNr, SiebAktiv; +extern int MampferMax, MampferNr, SiebAktiv; extern boolean network_player_action_received;