MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / HandleRabbotToggleControls

Method HandleRabbotToggleControls

Source/Main/engine.cpp:924–976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

922}
923
924void Engine::HandleRabbotToggleControls() {
925 Keyboard& keyboard = Input::Instance()->getKeyboard();
926
927 bool rabbot_mode = scenegraph_->map_editor->state_ == MapEditor::kInGame;
928 if (!rabbot_mode && keyboard.wasScancodePressed(SDL_SCANCODE_8, KIMF_PLAYING | KIMF_LEVEL_EDITOR_GENERAL)) {
929 scenegraph_->map_editor->SendInRabbot();
930 }
931 int menu_player = Input::Instance()->PlayerOpenedMenu();
932 if (menu_player != -1 && (current_menu_player == -1 || current_menu_player == menu_player)) {
933 if (rabbot_mode) {
934 if (current_engine_state_.type == kEngineEditorLevelState) {
935 scenegraph_->map_editor->StopRabbot();
936 } else {
937 current_menu_player = menu_player;
938 scenegraph_->level->Message("open_menu");
939 char buffer[48];
940 sprintf(buffer, "menu_player%i", menu_player);
941 scenegraph_->level->Message(buffer);
942 }
943 } else {
944 scenegraph_->level->Message("open_menu");
945 current_menu_player = menu_player;
946 char buffer[48];
947 sprintf(buffer, "menu_player%i", menu_player);
948 scenegraph_->level->Message(buffer);
949 }
950 Graphics::Instance()->SetMediaMode(false);
951 }
952
953 if (Online::Instance()->IsClient() && Online::Instance()->GetHostAllowsClientEditor() == false) {
954 if (current_engine_state_.type == kEngineEditorLevelState) {
955 current_engine_state_.type = kEngineLevelState;
956 scenegraph_->map_editor->SendInRabbot();
957 }
958 }
959
960 if (keyboard.wasScancodePressed(SDL_SCANCODE_F1, KIMF_PLAYING | KIMF_LEVEL_EDITOR_GENERAL)) {
961 if (Online::Instance()->IsClient()) {
962 if (Online::Instance()->GetHostAllowsClientEditor() == false && false) {
963 return;
964 }
965 }
966
967 if (current_engine_state_.type == kEngineLevelState) {
968 current_engine_state_.type = kEngineEditorLevelState;
969 scenegraph_->map_editor->StopRabbot();
970 Shaders::Instance()->create_program_warning = false;
971 } else if (current_engine_state_.type == kEngineEditorLevelState) {
972 current_engine_state_.type = kEngineLevelState;
973 scenegraph_->map_editor->SendInRabbot();
974 }
975 }
976}
977
978static void ClipPolyToPlane(std::vector<vec3>* poly_verts, vec3 plane_normal, float plane_distance) {
979 std::vector<vec3> clipped_verts;

Callers

nothing calls this directly

Calls 8

wasScancodePressedMethod · 0.80
SendInRabbotMethod · 0.80
PlayerOpenedMenuMethod · 0.80
StopRabbotMethod · 0.80
SetMediaModeMethod · 0.80
IsClientMethod · 0.80
MessageMethod · 0.45

Tested by

no test coverage detected