78 } |
78 } |
79 |
79 |
80 |
80 |
81 void CcPlaySound10(bool success, uint tile, uint32 p1, uint32 p2) |
81 void CcPlaySound10(bool success, uint tile, uint32 p1, uint32 p2) |
82 { |
82 { |
83 if (success) { SndPlayTileFx(0x10, tile); } |
83 if (success) SndPlayTileFx(SND_12_EXPLOSION, tile); |
84 } |
84 } |
85 |
85 |
86 |
86 |
87 typedef void ToolbarButtonProc(Window *w); |
87 typedef void ToolbarButtonProc(Window *w); |
88 |
88 |
89 static void ToolbarPauseClick(Window *w) |
89 static void ToolbarPauseClick(Window *w) |
90 { |
90 { |
91 if (_networking && !_networking_server) { return;} // only server can pause the game |
91 if (_networking && !_networking_server) { return;} // only server can pause the game |
92 |
92 |
93 if (DoCommandP(0, _pause?0:1, 0, NULL, CMD_PAUSE | CMD_NET_INSTANT)) |
93 if (DoCommandP(0, _pause?0:1, 0, NULL, CMD_PAUSE | CMD_NET_INSTANT)) |
94 SndPlayFx(0x13); |
94 SndPlayFx(SND_15_BEEP); |
95 } |
95 } |
96 |
96 |
97 static void ToolbarFastForwardClick(Window *w) |
97 static void ToolbarFastForwardClick(Window *w) |
98 { |
98 { |
99 _fast_forward ^= true; |
99 _fast_forward ^= true; |
100 SndPlayFx(0x13); |
100 SndPlayFx(SND_15_BEEP); |
101 } |
101 } |
102 |
102 |
103 |
103 |
104 typedef void MenuClickedProc(int index); |
104 typedef void MenuClickedProc(int index); |
105 |
105 |
594 WP(w,menu_d).string_id = base_string; |
594 WP(w,menu_d).string_id = base_string; |
595 WP(w,menu_d).checked_items = 0; |
595 WP(w,menu_d).checked_items = 0; |
596 |
596 |
597 _popup_menu_active = true; |
597 _popup_menu_active = true; |
598 |
598 |
599 SndPlayFx(0x13); |
599 SndPlayFx(SND_15_BEEP); |
600 |
600 |
601 return w; |
601 return w; |
602 } |
602 } |
603 |
603 |
604 static Window *PopupMainPlayerToolbMenu(Window *w, int x, int main_button, int gray) |
604 static Window *PopupMainPlayerToolbMenu(Window *w, int x, int main_button, int gray) |
615 WP(w,menu_d).sel_index = _local_player != OWNER_SPECTATOR ? _local_player : 0; |
615 WP(w,menu_d).sel_index = _local_player != OWNER_SPECTATOR ? _local_player : 0; |
616 WP(w,menu_d).action_id = main_button; |
616 WP(w,menu_d).action_id = main_button; |
617 WP(w,menu_d).main_button = main_button; |
617 WP(w,menu_d).main_button = main_button; |
618 WP(w,menu_d).checked_items = gray; |
618 WP(w,menu_d).checked_items = gray; |
619 _popup_menu_active = true; |
619 _popup_menu_active = true; |
620 SndPlayFx(0x13); |
620 SndPlayFx(SND_15_BEEP); |
621 return w; |
621 return w; |
622 } |
622 } |
623 |
623 |
624 static void ToolbarSaveClick(Window *w) |
624 static void ToolbarSaveClick(Window *w) |
625 { |
625 { |
779 |
779 |
780 static void ToolbarZoomInClick(Window *w) |
780 static void ToolbarZoomInClick(Window *w) |
781 { |
781 { |
782 if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
782 if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
783 HandleButtonClick(w, 17); |
783 HandleButtonClick(w, 17); |
784 SndPlayFx(0x13); |
784 SndPlayFx(SND_15_BEEP); |
785 } |
785 } |
786 } |
786 } |
787 |
787 |
788 static void ToolbarZoomOutClick(Window *w) |
788 static void ToolbarZoomOutClick(Window *w) |
789 { |
789 { |
790 if (DoZoomInOutWindow(ZOOM_OUT,FindWindowById(WC_MAIN_WINDOW, 0))) { |
790 if (DoZoomInOutWindow(ZOOM_OUT,FindWindowById(WC_MAIN_WINDOW, 0))) { |
791 HandleButtonClick(w, 18); |
791 HandleButtonClick(w, 18); |
792 SndPlayFx(0x13); |
792 SndPlayFx(SND_15_BEEP); |
793 } |
793 } |
794 } |
794 } |
795 |
795 |
796 static void ToolbarBuildRailClick(Window *w) |
796 static void ToolbarBuildRailClick(Window *w) |
797 { |
797 { |
892 |
892 |
893 static void ToolbarScenZoomIn(Window *w) |
893 static void ToolbarScenZoomIn(Window *w) |
894 { |
894 { |
895 if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
895 if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) { |
896 HandleButtonClick(w, 9); |
896 HandleButtonClick(w, 9); |
897 SndPlayFx(0x13); |
897 SndPlayFx(SND_15_BEEP); |
898 } |
898 } |
899 } |
899 } |
900 |
900 |
901 static void ToolbarScenZoomOut(Window *w) |
901 static void ToolbarScenZoomOut(Window *w) |
902 { |
902 { |
903 if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) { |
903 if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) { |
904 HandleButtonClick(w, 10); |
904 HandleButtonClick(w, 10); |
905 SndPlayFx(0x13); |
905 SndPlayFx(SND_15_BEEP); |
906 } |
906 } |
907 } |
907 } |
908 |
908 |
909 void ZoomInOrOutToCursorWindow(bool in, Window *w) |
909 void ZoomInOrOutToCursorWindow(bool in, Window *w) |
910 { |
910 { |
1009 // tile = TILE_FROM_XY(GET_TILE_X(tile)*16+_tile_fract_coords.x + 8,GET_TILE_Y(tile)*16+_tile_fract_coords.y + 8); |
1009 // tile = TILE_FROM_XY(GET_TILE_X(tile)*16+_tile_fract_coords.x + 8,GET_TILE_Y(tile)*16+_tile_fract_coords.y + 8); |
1010 |
1010 |
1011 if (_terraform_size == 1) { |
1011 if (_terraform_size == 1) { |
1012 DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO); |
1012 DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO); |
1013 } else { |
1013 } else { |
1014 SndPlayTileFx(0x1D, tile); |
1014 SndPlayTileFx(SND_1F_SPLAT, tile); |
1015 |
1015 |
1016 size = _terraform_size; |
1016 size = _terraform_size; |
1017 assert(size != 0); |
1017 assert(size != 0); |
1018 if (mode != 0) { |
1018 if (mode != 0) { |
1019 /* Raise land */ |
1019 /* Raise land */ |
1068 if (!IS_TILETYPE(tile, MP_CLEAR)) |
1068 if (!IS_TILETYPE(tile, MP_CLEAR)) |
1069 return; |
1069 return; |
1070 |
1070 |
1071 _map5[tile] = (_map5[tile] & ~0x1C) | 8; |
1071 _map5[tile] = (_map5[tile] & ~0x1C) | 8; |
1072 MarkTileDirtyByTile(tile); |
1072 MarkTileDirtyByTile(tile); |
1073 SndPlayTileFx(0x1D, tile); |
1073 SndPlayTileFx(SND_1F_SPLAT, tile); |
1074 } |
1074 } |
1075 |
1075 |
1076 static void PlaceProc_LightHouse(uint tile) |
1076 static void PlaceProc_LightHouse(uint tile) |
1077 { |
1077 { |
1078 TileInfo ti; |
1078 TileInfo ti; |
1080 FindLandscapeHeightByTile(&ti, tile); |
1080 FindLandscapeHeightByTile(&ti, tile); |
1081 if (ti.type != MP_CLEAR || (ti.tileh & 0x10)) |
1081 if (ti.type != MP_CLEAR || (ti.tileh & 0x10)) |
1082 return; |
1082 return; |
1083 |
1083 |
1084 ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 1); |
1084 ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 1); |
1085 SndPlayTileFx(0x1D, tile); |
1085 SndPlayTileFx(SND_1F_SPLAT, tile); |
1086 } |
1086 } |
1087 |
1087 |
1088 static void PlaceProc_Transmitter(uint tile) |
1088 static void PlaceProc_Transmitter(uint tile) |
1089 { |
1089 { |
1090 TileInfo ti; |
1090 TileInfo ti; |
1092 FindLandscapeHeightByTile(&ti, tile); |
1092 FindLandscapeHeightByTile(&ti, tile); |
1093 if (ti.type != MP_CLEAR || (ti.tileh & 0x10)) |
1093 if (ti.type != MP_CLEAR || (ti.tileh & 0x10)) |
1094 return; |
1094 return; |
1095 |
1095 |
1096 ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 0); |
1096 ModifyTile(tile, MP_SETTYPE(MP_UNMOVABLE) | MP_MAP5, 0); |
1097 SndPlayTileFx(0x1D, tile); |
1097 SndPlayTileFx(SND_1F_SPLAT, tile); |
1098 } |
1098 } |
1099 |
1099 |
1100 static void PlaceProc_Desert(uint tile) |
1100 static void PlaceProc_Desert(uint tile) |
1101 { |
1101 { |
1102 SetMapExtraBits(tile, GetMapExtraBits(tile) == 1 ? 0 : 1); |
1102 SetMapExtraBits(tile, GetMapExtraBits(tile) == 1 ? 0 : 1); |
1178 terraform_size_common:; |
1178 terraform_size_common:; |
1179 size += _terraform_size; |
1179 size += _terraform_size; |
1180 if (!IS_INT_INSIDE(size, 1, 8+1)) |
1180 if (!IS_INT_INSIDE(size, 1, 8+1)) |
1181 return; |
1181 return; |
1182 _terraform_size = size; |
1182 _terraform_size = size; |
1183 SndPlayFx(0x13); |
1183 SndPlayFx(SND_15_BEEP); |
1184 SetWindowDirty(w); |
1184 SetWindowDirty(w); |
1185 break; |
1185 break; |
1186 } |
1186 } |
1187 |
1187 |
1188 case 8: /* gen random land */ |
1188 case 8: /* gen random land */ |
1250 }; |
1250 }; |
1251 |
1251 |
1252 static void ToolbarScenGenLand(Window *w) |
1252 static void ToolbarScenGenLand(Window *w) |
1253 { |
1253 { |
1254 HandleButtonClick(w, 11); |
1254 HandleButtonClick(w, 11); |
1255 SndPlayFx(0x13); |
1255 SndPlayFx(SND_15_BEEP); |
1256 |
1256 |
1257 AllocateWindowDescFront(&_scen_edit_land_gen_desc, 0); |
1257 AllocateWindowDescFront(&_scen_edit_land_gen_desc, 0); |
1258 } |
1258 } |
1259 |
1259 |
1260 static void CcBuildTown(bool success, uint tile, uint32 p1, uint32 p2) |
1260 static void CcBuildTown(bool success, uint tile, uint32 p1, uint32 p2) |
1261 { |
1261 { |
1262 if (success) { |
1262 if (success) { |
1263 SndPlayTileFx(0x1D, tile); |
1263 SndPlayTileFx(SND_1F_SPLAT, tile); |
1264 ResetObjectToPlace(); |
1264 ResetObjectToPlace(); |
1265 } |
1265 } |
1266 } |
1266 } |
1267 |
1267 |
1268 static void PlaceProc_Town(uint tile) |
1268 static void PlaceProc_Town(uint tile) |
1592 |
1592 |
1593 |
1593 |
1594 static void ToolbarScenGenIndustry(Window *w) |
1594 static void ToolbarScenGenIndustry(Window *w) |
1595 { |
1595 { |
1596 HandleButtonClick(w, 13); |
1596 HandleButtonClick(w, 13); |
1597 SndPlayFx(0x13); |
1597 SndPlayFx(SND_15_BEEP); |
1598 AllocateWindowDescFront(_scenedit_industry_descs[_opt.landscape],0); |
1598 AllocateWindowDescFront(_scenedit_industry_descs[_opt.landscape],0); |
1599 } |
1599 } |
1600 |
1600 |
1601 static void ToolbarScenBuildRoad(Window *w) |
1601 static void ToolbarScenBuildRoad(Window *w) |
1602 { |
1602 { |
1603 HandleButtonClick(w, 14); |
1603 HandleButtonClick(w, 14); |
1604 SndPlayFx(0x13); |
1604 SndPlayFx(SND_15_BEEP); |
1605 ShowBuildRoadScenToolbar(); |
1605 ShowBuildRoadScenToolbar(); |
1606 } |
1606 } |
1607 |
1607 |
1608 static void ToolbarScenPlantTrees(Window *w) |
1608 static void ToolbarScenPlantTrees(Window *w) |
1609 { |
1609 { |
1610 HandleButtonClick(w, 15); |
1610 HandleButtonClick(w, 15); |
1611 SndPlayFx(0x13); |
1611 SndPlayFx(SND_15_BEEP); |
1612 ShowBuildTreesScenToolbar(); |
1612 ShowBuildTreesScenToolbar(); |
1613 } |
1613 } |
1614 |
1614 |
1615 static void ToolbarScenPlaceSign(Window *w) |
1615 static void ToolbarScenPlaceSign(Window *w) |
1616 { |
1616 { |
1617 HandleButtonClick(w, 16); |
1617 HandleButtonClick(w, 16); |
1618 SndPlayFx(0x13); |
1618 SndPlayFx(SND_15_BEEP); |
1619 SelectSignTool(); |
1619 SelectSignTool(); |
1620 } |
1620 } |
1621 |
1621 |
1622 static void ToolbarBtn_NULL(Window *w) |
1622 static void ToolbarBtn_NULL(Window *w) |
1623 { |
1623 { |