GADGET_ID_RANDOM_BALL_CONTENT,
GADGET_ID_INITIAL_BALL_STATE,
GADGET_ID_GROW_INTO_DIGGABLE,
+ GADGET_ID_SB_FIELDS_NEEDED,
+ GADGET_ID_SB_OBJECTS_NEEDED,
GADGET_ID_AUTO_EXIT_SOKOBAN,
GADGET_ID_SOLVED_BY_ONE_PLAYER,
GADGET_ID_CONTINUOUS_SNAPPING,
ED_CHECKBUTTON_ID_RANDOM_BALL_CONTENT,
ED_CHECKBUTTON_ID_INITIAL_BALL_STATE,
ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE,
+ ED_CHECKBUTTON_ID_SB_FIELDS_NEEDED,
+ ED_CHECKBUTTON_ID_SB_OBJECTS_NEEDED,
ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN,
ED_CHECKBUTTON_ID_SOLVED_BY_ONE_PLAYER,
ED_CHECKBUTTON_ID_CONTINUOUS_SNAPPING,
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
+ GADGET_ID_SB_FIELDS_NEEDED, GADGET_ID_NONE,
+ &level.sb_fields_needed,
+ NULL, NULL,
+ "all fields need to be filled", "require all SB fields to be solved"
+ },
+ {
+ ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
+ GADGET_ID_SB_OBJECTS_NEEDED, GADGET_ID_NONE,
+ &level.sb_objects_needed,
+ NULL, NULL,
+ "all objects need to be placed", "require all SB objects to be solved"
+ },
+ {
+ ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
GADGET_ID_AUTO_EXIT_SOKOBAN, GADGET_ID_NONE,
&level.auto_exit_sokoban,
NULL, NULL,
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE);
}
+ if (properties_element == EL_SOKOBAN_FIELD_EMPTY)
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_SB_FIELDS_NEEDED);
+
+ if (properties_element == EL_SOKOBAN_OBJECT)
+ MapCheckbuttonGadget(ED_CHECKBUTTON_ID_SB_OBJECTS_NEEDED);
+
if (properties_element == EL_SOKOBAN_OBJECT ||
properties_element == EL_SOKOBAN_FIELD_EMPTY ||
properties_element == EL_SOKOBAN_FIELD_FULL)
+ {
+ checkbutton_info[ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN].y =
+ ED_ELEMENT_SETTINGS_XPOS(properties_element == EL_SOKOBAN_FIELD_FULL ?
+ 0 : 1);
+
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN);
+ }
if (IS_BALLOON_ELEMENT(properties_element))
MapSelectboxGadget(ED_SELECTBOX_ID_WIND_DIRECTION);
&li.num_ball_contents, 4, MAX_ELEMENT_CONTENTS
},
+ {
+ EL_SOKOBAN_FIELD_EMPTY, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.sb_fields_needed, TRUE
+ },
+
+ {
+ EL_SOKOBAN_OBJECT, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
+ &li.sb_objects_needed, TRUE
+ },
+
{
EL_MM_MCDUFFIN, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
return element;
}
+static void IncrementPlayerSokobanFieldsNeeded(struct PlayerInfo *player)
+{
+ if (level.sb_fields_needed)
+ player->sokoban_fields_still_needed++;
+}
+
+static void IncrementPlayerSokobanObjectsNeeded(struct PlayerInfo *player)
+{
+ if (level.sb_objects_needed)
+ player->sokoban_objects_still_needed++;
+}
+
+static void DecrementPlayerSokobanFieldsNeeded(struct PlayerInfo *player)
+{
+ if (player->sokoban_fields_still_needed > 0)
+ player->sokoban_fields_still_needed--;
+}
+
+static void DecrementPlayerSokobanObjectsNeeded(struct PlayerInfo *player)
+{
+ if (player->sokoban_objects_still_needed > 0)
+ player->sokoban_objects_still_needed--;
+}
+
static void InitPlayerField(int x, int y, int element, boolean init_game)
{
if (element == EL_SP_MURPHY)
break;
case EL_SOKOBAN_FIELD_EMPTY:
- local_player->sokoban_fields_still_needed++;
+ IncrementPlayerSokobanFieldsNeeded(local_player);
break;
case EL_SOKOBAN_OBJECT:
- local_player->sokoban_objects_still_needed++;
+ IncrementPlayerSokobanObjectsNeeded(local_player);
break;
case EL_STONEBLOCK:
if (element == EL_SOKOBAN_FIELD_FULL)
{
Back[x][y] = EL_SOKOBAN_FIELD_EMPTY;
- local_player->sokoban_fields_still_needed++;
- local_player->sokoban_objects_still_needed++;
+
+ IncrementPlayerSokobanFieldsNeeded(local_player);
+ IncrementPlayerSokobanObjectsNeeded(local_player);
}
if (Feld[nextx][nexty] == EL_SOKOBAN_FIELD_EMPTY)
{
Back[nextx][nexty] = EL_SOKOBAN_FIELD_EMPTY;
- local_player->sokoban_fields_still_needed--;
- local_player->sokoban_objects_still_needed--;
+
+ DecrementPlayerSokobanFieldsNeeded(local_player);
+ DecrementPlayerSokobanObjectsNeeded(local_player);
// sokoban object was pushed from empty field to sokoban field
if (Back[x][y] == EL_EMPTY)