Rev 11 | Rev 20 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 11 | Rev 18 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | #include "controls.h" | 1 | #include "controls.h" | 
| 2 | 2 | ||
| 3 | #include " | 3 | #include "brender.h" | 
| 4 | #include "brucetrk.h" | 4 | #include "brucetrk.h" | 
| 5 | #include "car.h" | 5 | #include "car.h" | 
| 6 | #include "constants.h" | 6 | #include "constants.h" | 
| 7 | #include "crush.h" | 7 | #include "crush.h" | 
| 8 | #include "depth.h" | 8 | #include "depth.h" | 
| Line 1103... | Line 1103... | ||
| 1103 | } | 1103 | } | 
| 1104 | 1104 | ||
| 1105 | // IDA: void __cdecl CheckHelp() | 1105 | // IDA: void __cdecl CheckHelp() | 
| 1106 | void CheckHelp(void) { | 1106 | void CheckHelp(void) { | 
| 1107 | LOG_TRACE("()"); | 1107 | LOG_TRACE("()"); | 
| 1108 | NOT_IMPLEMENTED(); | - | |
| 1109 | } | 1108 | } | 
| 1110 | 1109 | ||
| 1111 | // IDA: void __cdecl CheckLoadSave() | 1110 | // IDA: void __cdecl CheckLoadSave() | 
| 1112 | void CheckLoadSave(void) { | 1111 | void CheckLoadSave(void) { | 
| 1113 | int save_load_allowed; | 1112 | int save_load_allowed; | 
| Line 1281... | Line 1280... | ||
| 1281 | } | 1280 | } | 
| 1282 | 1281 | ||
| 1283 | // IDA: void __usercall CheckHorn3D(tCar_spec *pCar@<EAX>) | 1282 | // IDA: void __usercall CheckHorn3D(tCar_spec *pCar@<EAX>) | 
| 1284 | void CheckHorn3D(tCar_spec* pCar) { | 1283 | void CheckHorn3D(tCar_spec* pCar) { | 
| 1285 | LOG_TRACE("(%p)", pCar); | 1284 | LOG_TRACE("(%p)", pCar); | 
| - | 1285 | ||
| - | 1286 | if (pCar->keys.horn && pCar->horn_sound_tag == 0) { | |
| - | 1287 | pCar->horn_sound_tag = DRS3StartSound3D(gEffects_outlet, | |
| - | 1288 | 5209, | |
| - | 1289 | &pCar->car_master_actor->t.t.translate.t, | |
| - | 1290 | &pCar->velocity_bu_per_sec, | |
| - | 1291 | 0, | |
| 1286 | 
 | 1292 | 255, | 
| - | 1293 | ((pCar->car_ID & 7) << 12) + 0xc000, | |
| - | 1294 | 0x10000); | |
| - | 1295 | } else { | |
| - | 1296 | if (!pCar->keys.horn && pCar->horn_sound_tag != 0) { | |
| - | 1297 | while (S3SoundStillPlaying(pCar->horn_sound_tag)) { | |
| - | 1298 | DRS3StopSound(pCar->horn_sound_tag); | |
| - | 1299 | DRS3StopOutletSound(gEffects_outlet); | |
| - | 1300 |             } | |
| - | 1301 | if (!S3SoundStillPlaying(pCar->horn_sound_tag)) { | |
| - | 1302 | pCar->horn_sound_tag = 0; | |
| - | 1303 |             } | |
| - | 1304 |         } | |
| - | 1305 |     } | |
| 1287 | } | 1306 | } | 
| 1288 | 1307 | ||
| 1289 | // IDA: void __cdecl CheckHorns() | 1308 | // IDA: void __cdecl CheckHorns() | 
| 1290 | void CheckHorns(void) { | 1309 | void CheckHorns(void) { | 
| 1291 | int i; | 1310 | int i; | 
| Line 1376... | Line 1395... | ||
| 1376 | 1395 | ||
| 1377 | old_y = gMap_render_y; | 1396 | old_y = gMap_render_y; | 
| 1378 | old_x = gMap_render_x; | 1397 | old_x = gMap_render_x; | 
| 1379 | if (gMap_mode) { | 1398 | if (gMap_mode) { | 
| 1380 | amount = gFrame_period * .1f; | 1399 | amount = gFrame_period * .1f; | 
| 1381 | if (KeyIsDown( | 1400 | if (KeyIsDown(KEYMAP_MOVE_UP)) { | 
| 1382 | gMap_render_y -= amount; | 1401 | gMap_render_y -= amount; | 
| 1383 | } else if (KeyIsDown( | 1402 | } else if (KeyIsDown(KEYMAP_MOVE_DOWN)) { | 
| 1384 | gMap_render_y += amount; | 1403 | gMap_render_y += amount; | 
| 1385 |         } | 1404 |         } | 
| 1386 | if (KeyIsDown( | 1405 | if (KeyIsDown(KEYMAP_MOVE_LEFT)) { | 
| 1387 | gMap_render_x -= amount; | 1406 | gMap_render_x -= amount; | 
| 1388 | } else if (KeyIsDown( | 1407 | } else if (KeyIsDown(KEYMAP_MOVE_RIGHT)) { | 
| 1389 | gMap_render_x += amount; | 1408 | gMap_render_x += amount; | 
| 1390 |         } | 1409 |         } | 
| 1391 | if (gMap_render_x != old_x || gMap_render_y != old_y) { | 1410 | if (gMap_render_x != old_x || gMap_render_y != old_y) { | 
| 1392 | SetIntegerMapRenders(); | 1411 | SetIntegerMapRenders(); | 
| 1393 | if (gMap_render_x_i < gCurrent_graf_data->map_render_x_marg) { | 1412 | if (gMap_render_x_i < gCurrent_graf_data->map_render_x_marg) { | 
| Line 1729... | Line 1748... | ||
| 1729 | LOG_TRACE("(%p)", car); | 1748 | LOG_TRACE("(%p)", car); | 
| 1730 | 1749 | ||
| 1731 | count = 0; | 1750 | count = 0; | 
| 1732 | if (car->driver == eDriver_local_human && gNet_mode == eNet_mode_none) { | 1751 | if (car->driver == eDriver_local_human && gNet_mode == eNet_mode_none) { | 
| 1733 | FadePaletteDown(); | 1752 | FadePaletteDown(); | 
| 1734 | while (KeyIsDown( | 1753 | while (KeyIsDown(KEYMAP_REPAIR)) { | 
| 1735 |             ; | 1754 |             ; | 
| 1736 |         } | 1755 |         } | 
| 1737 |     } | 1756 |     } | 
| 1738 | car->doing_nothing_flag = 0; | 1757 | car->doing_nothing_flag = 0; | 
| 1739 | EnableCar(car); | 1758 | EnableCar(car); | 
| Line 2469... | Line 2488... | ||
| 2469 |     } | 2488 |     } | 
| 2470 | } | 2489 | } | 
| 2471 | 2490 | ||
| 2472 | // IDA: void __cdecl EnterUserMessage() | 2491 | // IDA: void __cdecl EnterUserMessage() | 
| 2473 | void EnterUserMessage(void) { | 2492 | void EnterUserMessage(void) { | 
| 2474 | 
 | 2493 | static int last_key; | 
| 2475 | 
 | 2494 | static int about_to_die; | 
| 2476 | 
 | 2495 | static tU32 next_time; | 
| 2477 | 
 | 2496 | char* the_message; | 
| 2478 | 
 | 2497 | char* p; | 
| 2479 | 
 | 2498 | int len; | 
| 2480 | 
 | 2499 | int the_key; | 
| 2481 | 
 | 2500 | int abuse_num; | 
| 2482 | LOG_TRACE("()"); | 2501 | LOG_TRACE("()"); | 
| - | 2502 | ||
| - | 2503 | if (!gEntering_message) { | |
| - | 2504 | return; | |
| - | 2505 |     } | |
| - | 2506 | if (gNet_mode == eNet_mode_none) { | |
| 2483 | 
 | 2507 | return; | 
| - | 2508 |     } | |
| - | 2509 | if (!gCurrent_net_game->options.enable_text_messages) { | |
| - | 2510 | return; | |
| - | 2511 |     } | |
| - | 2512 | the_key = PDAnyKeyDown(); | |
| - | 2513 | if (gEntering_message == 1) { | |
| - | 2514 | if (the_key != -1) { | |
| - | 2515 | return; | |
| - | 2516 |         } | |
| - | 2517 | gEntering_message = 2; | |
| - | 2518 |     } | |
| - | 2519 | if (about_to_die) { | |
| - | 2520 | if (the_key != -1) { | |
| - | 2521 | return; | |
| - | 2522 |         } | |
| - | 2523 | gEntering_message = 0; | |
| - | 2524 | about_to_die = 0; | |
| - | 2525 | return; | |
| - | 2526 |     } | |
| - | 2527 | if (the_key == last_key) { | |
| - | 2528 | if (next_time < PDGetTotalTime()) { | |
| - | 2529 | next_time += 100; | |
| - | 2530 | } else { | |
| - | 2531 | the_key = -1; | |
| - | 2532 |         } | |
| - | 2533 | } else { | |
| - | 2534 | last_key = the_key; | |
| - | 2535 | next_time = PDGetTotalTime() + 500; | |
| - | 2536 |     } | |
| - | 2537 | switch (the_key) { | |
| - | 2538 | case -1: | |
| - | 2539 | case KEY_SHIFT_ANY: | |
| - | 2540 | break; | |
| - | 2541 | case KEY_CTRL_ANY: | |
| - | 2542 | case KEY_CTRL_ANY_2: | |
| - | 2543 | case KEY_TAB: | |
| - | 2544 | case KEY_ESCAPE: | |
| - | 2545 | about_to_die = 1; | |
| - | 2546 | break; | |
| - | 2547 | case KEY_BACKSPACE: | |
| - | 2548 | case KEY_DELETE: | |
| - | 2549 | case KEY_LEFT: | |
| - | 2550 | len = strlen(&gString[20]); | |
| - | 2551 | if (len > 0) { | |
| - | 2552 | gString[20 + len - 1] = '\0'; | |
| - | 2553 |         } | |
| - | 2554 | break; | |
| - | 2555 | case KEY_RETURN: | |
| - | 2556 | case KEY_KP_ENTER: | |
| - | 2557 | len = strlen(gNet_players[gThis_net_player_index].player_name); | |
| - | 2558 | if (len <= 18) { | |
| - | 2559 | the_message = gString + 18 - len; | |
| - | 2560 | strcpy(the_message, gNet_players[gThis_net_player_index].player_name); | |
| - | 2561 | the_message[len + 0] = ':'; | |
| - | 2562 | the_message[len + 1] = ' '; | |
| - | 2563 | gString[COUNT_OF(gString) - 1] = '\0'; | |
| - | 2564 | NetSendHeadupToAllPlayers(the_message); | |
| - | 2565 | gString[20] = '\0'; | |
| - | 2566 | NewTextHeadupSlot(4, 0, 1000, -4, GetMiscString(kMiscString_MESSAGE_SENT)); | |
| - | 2567 | about_to_die = 1; | |
| - | 2568 |         } | |
| - | 2569 | break; | |
| - | 2570 | default: | |
| - | 2571 | if (gKey_mapping[KEYMAP_SEND_MESSAGE] == the_key) { | |
| - | 2572 | about_to_die = 1; | |
| - | 2573 | } else if (the_key <= KEY_KP_NUMLOCK || the_key >= KEY_SPACE) { | |
| - | 2574 | len = strlen(&gString[20]); | |
| - | 2575 | if (len < 64 - 1) { | |
| - | 2576 | gString[20 + len] = PDGetASCIIFromKey(the_key); | |
| - | 2577 | if (gString[20 + len] < gFonts[4].offset || gString[20 + len] >= gFonts[4].offset + gFonts[4].num_entries) { | |
| - | 2578 | gString[20 + len] = '\0'; | |
| - | 2579 |                 } | |
| - | 2580 | gString[20 + len + 1] = '\0'; | |
| - | 2581 |             } | |
| - | 2582 | } else if (the_key < KEY_KP_0 || the_key > KEY_KP_9) { | |
| - | 2583 | gEntering_message = 0; | |
| - | 2584 | } else { | |
| - | 2585 | if (the_key == KEY_KP_0) { | |
| - | 2586 | abuse_num = 9; | |
| - | 2587 | } else { | |
| - | 2588 | abuse_num = the_key - KEY_KP_1; | |
| - | 2589 |             } | |
| - | 2590 | if (gAbuse_text[abuse_num] != NULL) { | |
| - | 2591 | strcpy(&gString[20], gAbuse_text[abuse_num]); | |
| - | 2592 |             } | |
| - | 2593 |         } | |
| - | 2594 |     } | |
| 2484 | } | 2595 | } | 
| 2485 | 2596 | ||
| 2486 | // IDA: void __cdecl DisplayUserMessage() | 2597 | // IDA: void __cdecl DisplayUserMessage() | 
| 2487 | void DisplayUserMessage(void) { | 2598 | void DisplayUserMessage(void) { | 
| 2488 | 
 | 2599 | char* the_message; | 
| 2489 | 
 | 2600 | int len; | 
| 2490 | 
 | 2601 | tDR_font* font; | 
| 2491 | LOG_TRACE("()"); | 2602 | LOG_TRACE("()"); | 
| - | 2603 | ||
| - | 2604 | font = &gFonts[FONT_NEWHITE]; | |
| - | 2605 | the_message = &gString[20]; | |
| - | 2606 | if (!gEntering_message || gNet_mode == eNet_mode_none) { | |
| - | 2607 | return; | |
| - | 2608 |     } | |
| - | 2609 | ||
| - | 2610 | len = strlen(the_message); | |
| - | 2611 | if (len < 63 && (PDGetTotalTime() & 512) != 0) { | |
| - | 2612 | the_message[len] = '_'; | |
| - | 2613 | the_message[len + 1] = '\0'; | |
| - | 2614 |     } | |
| - | 2615 | DimRectangle(gBack_screen, | |
| - | 2616 | 15 * gBack_screen->width / 100, | |
| - | 2617 | gCurrent_graf_data->net_message_enter_y - font->height, | |
| - | 2618 | 85 * gBack_screen->width / 100, | |
| - | 2619 | gCurrent_graf_data->net_message_enter_y + 6 * font->height, | |
| - | 2620 | 1); | |
| - | 2621 | ||
| - | 2622 | TransDRPixelmapText(gBack_screen, 20 * gBack_screen->width / 100, gCurrent_graf_data->net_message_enter_y, font, GetMiscString(kMiscString_ENTER_MESSAGE), 100); | |
| - | 2623 |     OoerrIveGotTextInMeBoxMissus( | |
| 2492 | 
 | 2624 |         FONT_NEWHITE, | 
| - | 2625 |         the_message, | |
| - | 2626 |         gBack_screen, | |
| - | 2627 | 20 * gBack_screen->width / 100, | |
| - | 2628 | gCurrent_graf_data->net_message_enter_y + 2 * font->height, | |
| - | 2629 | 80 * gBack_screen->width / 100, | |
| - | 2630 | gCurrent_graf_data->net_message_enter_y + 6 * font->height, | |
| - | 2631 | 0); | |
| - | 2632 | the_message[len] = 0; | |
| 2493 | } | 2633 | } | 
| 2494 | 2634 | ||
| 2495 | // IDA: void __cdecl InitAbuseomatic() | 2635 | // IDA: void __cdecl InitAbuseomatic() | 
| 2496 | void InitAbuseomatic(void) { | 2636 | void InitAbuseomatic(void) { | 
| 2497 | char path[256]; | 2637 | char path[256]; |