Rev 18 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 18 | Rev 20 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "controls.h" |
1 | #include "controls.h" |
2 | 2 | ||
3 | #include "brender.h" |
3 | #include "brender/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(); |
|
1108 | } |
1109 | } |
1109 | 1110 | ||
1110 | // IDA: void __cdecl CheckLoadSave() |
1111 | // IDA: void __cdecl CheckLoadSave() |
1111 | void CheckLoadSave(void) { |
1112 | void CheckLoadSave(void) { |
1112 | int save_load_allowed; |
1113 | int save_load_allowed; |
Line 1280... | Line 1281... | ||
1280 | } |
1281 | } |
1281 | 1282 | ||
1282 | // IDA: void __usercall CheckHorn3D(tCar_spec *pCar@<EAX>) |
1283 | // IDA: void __usercall CheckHorn3D(tCar_spec *pCar@<EAX>) |
1283 | void CheckHorn3D(tCar_spec* pCar) { |
1284 | void CheckHorn3D(tCar_spec* pCar) { |
1284 | LOG_TRACE("(%p)", pCar); |
1285 | 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, |
- | |
1292 |
|
1286 | STUB_ONCE(); |
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 | } |
- | |
1306 | } |
1287 | } |
1307 | 1288 | ||
1308 | // IDA: void __cdecl CheckHorns() |
1289 | // IDA: void __cdecl CheckHorns() |
1309 | void CheckHorns(void) { |
1290 | void CheckHorns(void) { |
1310 | int i; |
1291 | int i; |
Line 1395... | Line 1376... | ||
1395 | 1376 | ||
1396 | old_y = gMap_render_y; |
1377 | old_y = gMap_render_y; |
1397 | old_x = gMap_render_x; |
1378 | old_x = gMap_render_x; |
1398 | if (gMap_mode) { |
1379 | if (gMap_mode) { |
1399 | amount = gFrame_period * .1f; |
1380 | amount = gFrame_period * .1f; |
1400 | if (KeyIsDown( |
1381 | if (KeyIsDown(30)) { |
1401 | gMap_render_y -= amount; |
1382 | gMap_render_y -= amount; |
1402 | } else if (KeyIsDown( |
1383 | } else if (KeyIsDown(31)) { |
1403 | gMap_render_y += amount; |
1384 | gMap_render_y += amount; |
1404 | } |
1385 | } |
1405 | if (KeyIsDown( |
1386 | if (KeyIsDown(32)) { |
1406 | gMap_render_x -= amount; |
1387 | gMap_render_x -= amount; |
1407 | } else if (KeyIsDown( |
1388 | } else if (KeyIsDown(33)) { |
1408 | gMap_render_x += amount; |
1389 | gMap_render_x += amount; |
1409 | } |
1390 | } |
1410 | if (gMap_render_x != old_x || gMap_render_y != old_y) { |
1391 | if (gMap_render_x != old_x || gMap_render_y != old_y) { |
1411 | SetIntegerMapRenders(); |
1392 | SetIntegerMapRenders(); |
1412 | if (gMap_render_x_i < gCurrent_graf_data->map_render_x_marg) { |
1393 | if (gMap_render_x_i < gCurrent_graf_data->map_render_x_marg) { |
Line 1748... | Line 1729... | ||
1748 | LOG_TRACE("(%p)", car); |
1729 | LOG_TRACE("(%p)", car); |
1749 | 1730 | ||
1750 | count = 0; |
1731 | count = 0; |
1751 | if (car->driver == eDriver_local_human && gNet_mode == eNet_mode_none) { |
1732 | if (car->driver == eDriver_local_human && gNet_mode == eNet_mode_none) { |
1752 | FadePaletteDown(); |
1733 | FadePaletteDown(); |
1753 | while (KeyIsDown( |
1734 | while (KeyIsDown(44)) { |
1754 | ; |
1735 | ; |
1755 | } |
1736 | } |
1756 | } |
1737 | } |
1757 | car->doing_nothing_flag = 0; |
1738 | car->doing_nothing_flag = 0; |
1758 | EnableCar(car); |
1739 | EnableCar(car); |
Line 2153... | Line 2134... | ||
2153 | } |
2134 | } |
2154 | } |
2135 | } |
2155 | 2136 | ||
2156 | // IDA: void __cdecl EarnDosh() |
2137 | // IDA: void __cdecl EarnDosh() |
2157 | void EarnDosh(void) { |
2138 | void EarnDosh(void) { |
2158 | LOG_TRACE("()"); |
2139 | LOG_TRACE("()"); |
2159 | 2140 | ||
2160 | EarnCredits(5000); |
2141 | EarnCredits(5000); |
2161 | } |
2142 | } |
2162 | 2143 | ||
2163 | // IDA: void __cdecl LoseDosh() |
2144 | // IDA: void __cdecl LoseDosh() |
Line 2488... | Line 2469... | ||
2488 | } |
2469 | } |
2489 | } |
2470 | } |
2490 | 2471 | ||
2491 | // IDA: void __cdecl EnterUserMessage() |
2472 | // IDA: void __cdecl EnterUserMessage() |
2492 | void EnterUserMessage(void) { |
2473 | void EnterUserMessage(void) { |
2493 |
|
2474 | //static int last_key; // Pierre-Marie Baty -- unused variable |
2494 |
|
2475 | //static int about_to_die; // Pierre-Marie Baty -- unused variable |
2495 |
|
2476 | //static tU32 next_time; // Pierre-Marie Baty -- unused variable |
2496 |
|
2477 | //char* the_message; // Pierre-Marie Baty -- unused variable |
2497 |
|
2478 | //char* p; // Pierre-Marie Baty -- unused variable |
2498 |
|
2479 | //int len; // Pierre-Marie Baty -- unused variable |
2499 |
|
2480 | //int the_key; // Pierre-Marie Baty -- unused variable |
2500 |
|
2481 | //int abuse_num; // Pierre-Marie Baty -- unused variable |
2501 | LOG_TRACE("()"); |
2482 | LOG_TRACE("()"); |
2502 | - | ||
2503 | if (!gEntering_message) { |
- | |
2504 | return; |
- | |
2505 | } |
- | |
2506 | if (gNet_mode == eNet_mode_none) { |
- | |
2507 |
|
2483 | STUB_ONCE(); |
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 | } |
- | |
2595 | } |
2484 | } |
2596 | 2485 | ||
2597 | // IDA: void __cdecl DisplayUserMessage() |
2486 | // IDA: void __cdecl DisplayUserMessage() |
2598 | void DisplayUserMessage(void) { |
2487 | void DisplayUserMessage(void) { |
2599 |
|
2488 | //char* the_message; // Pierre-Marie Baty -- unused variable |
2600 |
|
2489 | //int len; // Pierre-Marie Baty -- unused variable |
2601 | tDR_font |
2490 | //tDR_font* font; // Pierre-Marie Baty -- unused variable |
2602 | LOG_TRACE("()"); |
2491 | 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( |
- | |
2624 |
|
2492 | NOT_IMPLEMENTED(); |
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; |
- | |
2633 | } |
2493 | } |
2634 | 2494 | ||
2635 | // IDA: void __cdecl InitAbuseomatic() |
2495 | // IDA: void __cdecl InitAbuseomatic() |
2636 | void InitAbuseomatic(void) { |
2496 | void InitAbuseomatic(void) { |
2637 | char path[256]; |
2497 | char path[256]; |