MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ProcessGuidebotKeys

Function ProcessGuidebotKeys

Descent3/GameLoop.cpp:1171–1233  ·  view source on GitHub ↗

Handles guidebot shortcut keys

Source from the content-addressed store, hash-verified

1169#define GBC_RETURN_TO_SHIP 43 // Return to ship
1170// Handles guidebot shortcut keys
1171void ProcessGuidebotKeys(int key) {
1172 if (!(key & KEY_SHIFTED))
1173 return;
1174 key &= ~KEY_SHIFTED;
1175
1176 // check to make sure our Guidebot is out of the ship
1177 object *buddy = ObjGet(Buddy_handle[Player_num]);
1178 if (!buddy || buddy->type != OBJ_ROBOT) {
1179 // not out of the ship
1180 mprintf(0, "Guidebot: mrmph mmrump..mrmph...LET ME OUT OF YOUR SHIP!\n");
1181 return;
1182 }
1183 int command_id = -1;
1184
1185 switch (key) {
1186 case KEY_1:
1187 command_id = GBC_FIND_ACTIVE_GOAL_0;
1188 break;
1189 case KEY_2:
1190 command_id = GBC_FIND_SPEW;
1191 break;
1192 case KEY_3:
1193 command_id = GBC_FIND_POWERUP;
1194 break;
1195 case KEY_4:
1196 command_id = GBC_FIND_ENERGY_CENTER;
1197 break;
1198 case KEY_5:
1199 command_id = GBC_ESCORT_SHIP;
1200 break;
1201 case KEY_6:
1202 command_id = GBC_EXTINGUISH;
1203 break;
1204 case KEY_7:
1205 command_id = GBC_GO_WINGNUT;
1206 break;
1207 case KEY_8:
1208 command_id = GBC_RTYPE;
1209 break;
1210 case KEY_9:
1211 command_id = GBC_ANTI_VIRUS;
1212 break;
1213 case KEY_0:
1214 command_id = GBC_RETURN_TO_SHIP;
1215 break;
1216 default:
1217 // nope
1218 return;
1219 break;
1220 }
1221
1222 // Process the command
1223 gb_com command;
1224 command.action = COM_DO_ACTION;
1225 command.index = command_id;
1226 command.ptr = NULL;
1227
1228 if ((!(Game_mode & GM_MULTI)) || (Netgame.local_role != LR_CLIENT)) {

Callers 1

ProcessNormalKeyFunction · 0.85

Calls 3

ObjGetFunction · 0.85
AINotifyFunction · 0.85

Tested by

no test coverage detected