1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "scumm/he/intern_he.h"
#include "scumm/he/logic_he.h"
#include "scumm/he/basketball/basketball.h"
#include "scumm/he/basketball/collision/bball_collision.h"
#include "scumm/he/basketball/geo_translations.h"
namespace Scumm {
// Opcodes
#define WORLD_TO_SCREEN_TRANSLATION 1006
#define WORLD_TO_SCREEN_TRANSLATION_PARAMS 3
#define SCREEN_TO_WORLD_TRANSLATION 1010
#define SCREEN_TO_WORLD_TRANSLATION_PARAMS 2
#define INIT_SCREEN_TRANSLATIONS 1011
#define INIT_SCREEN_TRANSLATIONS_PARAMS 0
#define GET_COURT_DIMENSIONS 1012
#define GET_COURT_DIMENSIONS_PARAMS 0
#define COMPUTE_INITIAL_SHOT_VELOCITY 1030
#define COMPUTE_INITIAL_SHOT_VELOCITY_PARAMS 4
#define COMPUTE_TRAJECTORY_TO_TARGET 1031
#define COMPUTE_TRAJECTORY_TO_TARGET_PARAMS 7
#define COMPUTE_LAUNCH_TRAJECTORY 1032
#define COMPUTE_LAUNCH_TRAJECTORY_PARAMS 6
#define COMPUTE_ANGLE_OF_SHOT 1033
#define COMPUTE_ANGLE_OF_SHOT_PARAMS 2
#define COMPUTE_ANGLE_OF_PASS 1034
#define COMPUTE_ANGLE_OF_PASS_PARAMS 4
#define COMPUTE_POINTS_FOR_PIXELS 1035
#define COMPUTE_POINTS_FOR_PIXELS_PARAMS 2
#define COMPUTE_ANGLE_OF_BOUNCE_PASS 1036
#define COMPUTE_ANGLE_OF_BOUNCE_PASS_PARAMS 5
#define COMPUTE_BANK_SHOT_TARGET 1037
#define COMPUTE_BANK_SHOT_TARGET_PARAMS 4
#define COMPUTE_SWOOSH_TARGET 1038
#define COMPUTE_SWOOSH_TARGET_PARAMS 4
#define DETECT_SHOT_MADE 1039
#define DETECT_SHOT_MADE_PARAMS 9
#define COMPUTE_ANGLE_BETWEEN_VECTORS 1040
#define COMPUTE_ANGLE_BETWEEN_VECTORS_PARAMS 6
#define HIT_MOVING_TARGET 1041
#define HIT_MOVING_TARGET_PARAMS 7
#define GET_PASS_TARGET 1042
#define GET_PASS_TARGET_PARAMS 3
#define DETECT_PASS_BLOCKER 1043
#define DETECT_PASS_BLOCKER_PARAMS 3
#define GET_BALL_INTERCEPT 1044
#define GET_BALL_INTERCEPT_PARAMS 4
#define INIT_COURT 1050
#define INIT_COURT_PARAMS 1
#define INIT_BALL 1051
#define INIT_BALL_PARAMS 8
#define INIT_PLAYER 1052
#define INIT_PLAYER_PARAMS 7
#define DEINIT_COURT 1053
#define DEINIT_COURT_PARAMS 0
#define DEINIT_BALL 1054
#define DEINIT_BALL_PARAMS 0
#define DEINIT_PLAYER 1055
#define DEINIT_PLAYER_PARAMS 1
#define DETECT_BALL_COLLISION 1056
#define DETECT_BALL_COLLISION_PARAMS 8
#define DETECT_PLAYER_COLLISION 1057
#define DETECT_PLAYER_COLLISION_PARAMS 8
#define GET_LAST_BALL_COLLISION 1058
#define GET_LAST_BALL_COLLISION_PARAMS 1
#define GET_LAST_PLAYER_COLLISION 1059
#define GET_LAST_PLAYER_COLLISION_PARAMS 1
#define INIT_VIRTUAL_BALL 1060
#define INIT_VIRTUAL_BALL_PARAMS 8
#define DEINIT_VIRTUAL_BALL 1061
#define DEINIT_VIRTUAL_BALL_PARAMS 0
#define PLAYER_OFF 1062
#define PLAYER_OFF_PARAMS 1
#define PLAYER_ON 1063
#define PLAYER_ON_PARAMS 1
#define RAISE_SHIELDS 1064
#define RAISE_SHIELDS_PARAMS 1
#define LOWER_SHIELDS 1065
#define LOWER_SHIELDS_PARAMS 1
#define FIND_PLAYER_CLOSEST_TO_BALL 1066
#define FIND_PLAYER_CLOSEST_TO_BALL_PARAMS 1
#define IS_PLAYER_IN_BOUNDS 1067
#define IS_PLAYER_IN_BOUNDS_PARAMS 1
#define ARE_SHIELDS_CLEAR 1068
#define ARE_SHIELDS_CLEAR_PARAMS 0
#define SHIELD_PLAYER 1069
#define SHIELD_PLAYER_PARAMS 2
#define CLEAR_PLAYER_SHIELD 1070
#define CLEAR_PLAYER_SHIELD_PARAMS 1
#define IS_BALL_IN_BOUNDS 1071
#define IS_BALL_IN_BOUNDS_PARAMS 0
#define GET_AVOIDANCE_PATH 1072
#define GET_AVOIDANCE_PATH_PARAMS 4
#define SET_BALL_LOCATION 1073
#define SET_BALL_LOCATION_PARAMS 4
#define GET_BALL_LOCATION 1074
#define GET_BALL_LOCATION_PARAMS 1
#define SET_PLAYER_LOCATION 1075
#define SET_PLAYER_LOCATION_PARAMS 4
#define GET_PLAYER_LOCATION 1076
#define GET_PLAYER_LOCATION_PARAMS 1
#define START_BLOCK 1077
#define START_BLOCK_PARAMS 3
#define HOLD_BLOCK 1078
#define HOLD_BLOCK_PARAMS 1
#define END_BLOCK 1079
#define END_BLOCK_PARAMS 1
#define IS_PLAYER_IN_GAME 1080
#define IS_PLAYER_IN_GAME_PARAMS 1
#define IS_BALL_IN_GAME 1081
#define IS_BALL_IN_GAME_PARAMS 1
#define UPDATE_CURSOR_POS 1090
#define UPDATE_CURSOR_POS_PARAMS 2
#define MAKE_CURSOR_STICKY 1091
#define MAKE_CURSOR_STICKY_PARAMS 2
#define CURSOR_TRACK_MOVING_OBJECT 1092
#define CURSOR_TRACK_MOVING_OBJECT_PARAMS 2
#define GET_CURSOR_POSITION 1093
#define GET_CURSOR_POSITION_PARAMS 0
#define AI_GET_OPEN_SPOT 1100
#define AI_GET_OPEN_SPOT_PARAMS 10
#define AI_GET_OPPONENTS_IN_CONE 1101
#define AI_GET_OPPONENTS_IN_CONE_PARAMS 6
#define U32_CLEAN_UP_OFF_HEAP 1102
#define U32_CLEAN_UP_OFF_HEAP_PARAMS 0
#define DRAW_DEBUG_LINES 1500
#define DRAW_DEBUG_LINES_PARAMS 0
#define ADD_DEBUG_GEOM 1501
int LogicHEBasketball::versionID() {
return 1;
}
int32 LogicHEBasketball::dispatch(int cmdID, int paramCount, int32 *params) {
U32FltPoint3D flt3DPoint1, flt3DPoint2;
U32FltPoint2D flt2DPoint1, flt2DPoint2;
U32IntVector3D int3DVector1;
U32FltVector3D flt3DVector1, flt3DVector2;
U32FltVector2D flt2DVector1;
U32Sphere sphere1;
int retValue = 0;
switch (cmdID) {
case INIT_SCREEN_TRANSLATIONS:
assert(paramCount == INIT_SCREEN_TRANSLATIONS_PARAMS);
retValue = u32_userInitScreenTranslations();
break;
case WORLD_TO_SCREEN_TRANSLATION:
assert(paramCount == WORLD_TO_SCREEN_TRANSLATION_PARAMS);
flt3DPoint1.x = (float)params[0];
flt3DPoint1.y = (float)params[1];
flt3DPoint1.z = (float)params[2];
retValue = u32_userWorldToScreenTranslation(flt3DPoint1);
break;
case SCREEN_TO_WORLD_TRANSLATION:
assert(paramCount == SCREEN_TO_WORLD_TRANSLATION_PARAMS);
flt2DPoint1.x = (float)params[0];
flt2DPoint1.y = (float)params[1];
retValue = u32_userScreenToWorldTranslation(flt2DPoint1);
break;
case GET_COURT_DIMENSIONS:
assert(paramCount == GET_COURT_DIMENSIONS_PARAMS);
retValue = u32_userGetCourtDimensions();
break;
case COMPUTE_TRAJECTORY_TO_TARGET:
assert(paramCount == COMPUTE_TRAJECTORY_TO_TARGET_PARAMS);
flt3DPoint1.x = (float)params[0];
flt3DPoint1.y = (float)params[1];
flt3DPoint1.z = (float)params[2];
flt3DPoint2.x = (float)params[3];
flt3DPoint2.y = (float)params[4];
flt3DPoint2.z = (float)params[5];
retValue = u32_userComputeTrajectoryToTarget(flt3DPoint1, flt3DPoint2, params[6]);
break;
case COMPUTE_LAUNCH_TRAJECTORY:
assert(paramCount == COMPUTE_LAUNCH_TRAJECTORY_PARAMS);
flt2DPoint1.x = (float)params[0];
flt2DPoint1.y = (float)params[1];
flt2DPoint2.x = (float)params[2];
flt2DPoint2.y = (float)params[3];
retValue = u32_userComputeLaunchTrajectory(flt2DPoint1, flt2DPoint2, params[4], params[5]);
break;
case COMPUTE_ANGLE_BETWEEN_VECTORS:
assert(paramCount == COMPUTE_ANGLE_BETWEEN_VECTORS_PARAMS);
flt3DVector1.x = (float)params[0];
flt3DVector1.y = (float)params[1];
flt3DVector1.z = (float)params[2];
flt3DVector2.x = (float)params[3];
flt3DVector2.y = (float)params[4];
flt3DVector2.z = (float)params[5];
retValue = u32_userComputeAngleBetweenVectors(flt3DVector1, flt3DVector2);
break;
case COMPUTE_INITIAL_SHOT_VELOCITY:
assert(paramCount == COMPUTE_INITIAL_SHOT_VELOCITY_PARAMS);
retValue = u32_userComputeInitialShotVelocity(params[0], params[1], params[2], params[3]);
break;
case COMPUTE_ANGLE_OF_SHOT:
assert(paramCount == COMPUTE_ANGLE_OF_SHOT_PARAMS);
retValue = u32_userComputeAngleOfShot(params[0], params[1]);
break;
case COMPUTE_ANGLE_OF_PASS:
assert(paramCount == COMPUTE_ANGLE_OF_PASS_PARAMS);
retValue = u32_userComputeAngleOfPass(params[0], params[1], params[2], params[3]);
break;
case COMPUTE_ANGLE_OF_BOUNCE_PASS:
assert(paramCount == COMPUTE_ANGLE_OF_BOUNCE_PASS_PARAMS);
retValue = u32_userComputeAngleOfBouncePass(params[0], params[1], params[2], params[3], params[4]);
break;
case HIT_MOVING_TARGET:
assert(paramCount == HIT_MOVING_TARGET_PARAMS);
flt2DPoint1.x = (float)params[0];
flt2DPoint1.y = (float)params[1];
flt2DPoint2.x = (float)params[2];
flt2DPoint2.y = (float)params[3];
flt2DVector1.x = (float)params[4];
flt2DVector1.y = (float)params[5];
retValue = u32_userHitMovingTarget(flt2DPoint1, flt2DPoint2, flt2DVector1, params[6]);
break;
case GET_PASS_TARGET:
assert(paramCount == GET_PASS_TARGET_PARAMS);
flt3DVector1.x = (float)params[1];
flt3DVector1.y = (float)params[2];
retValue = u32_userGetPassTarget(params[0], flt3DVector1);
break;
case DETECT_PASS_BLOCKER:
assert(paramCount == DETECT_PASS_BLOCKER_PARAMS);
flt3DVector1.x = (float)params[1];
flt3DVector1.y = (float)params[2];
retValue = u32_userDetectPassBlocker(params[0], flt3DVector1);
break;
case GET_BALL_INTERCEPT:
assert(paramCount == GET_BALL_INTERCEPT_PARAMS);
retValue = u32_userGetBallIntercept(params[0], params[1], params[2], params[3]);
break;
case COMPUTE_POINTS_FOR_PIXELS:
assert(paramCount == COMPUTE_POINTS_FOR_PIXELS_PARAMS);
retValue = u32_userComputePointsForPixels(params[0], params[1]);
break;
case COMPUTE_BANK_SHOT_TARGET:
assert(paramCount == COMPUTE_BANK_SHOT_TARGET_PARAMS);
flt3DPoint1.x = (float)params[0];
flt3DPoint1.y = (float)params[1];
flt3DPoint1.z = (float)params[2];
retValue = u32_userComputeBankShotTarget(flt3DPoint1, params[3]);
break;
case COMPUTE_SWOOSH_TARGET:
assert(paramCount == COMPUTE_SWOOSH_TARGET_PARAMS);
flt3DPoint1.x = (float)params[0];
flt3DPoint1.y = (float)params[1];
flt3DPoint1.z = (float)params[2];
retValue = u32_userComputeSwooshTarget(flt3DPoint1, params[3]);
break;
case INIT_COURT:
assert(paramCount == INIT_COURT_PARAMS);
retValue = u32_userInitCourt(params[0]);
break;
case DEINIT_COURT:
assert(paramCount == DEINIT_COURT_PARAMS);
retValue = u32_userDeinitCourt();
break;
case INIT_BALL:
assert(paramCount == INIT_BALL_PARAMS);
flt3DPoint1.x = (float)params[0];
flt3DPoint1.y = (float)params[1];
flt3DPoint1.z = (float)params[2];
flt3DVector1.x = (float)params[3];
flt3DVector1.y = (float)params[4];
flt3DVector1.z = (float)params[5];
retValue = u32_userInitBall(flt3DPoint1, flt3DVector1, params[6], params[7]);
break;
case DEINIT_BALL:
assert(paramCount == DEINIT_BALL_PARAMS);
retValue = u32_userDeinitBall();
break;
case INIT_VIRTUAL_BALL:
assert(paramCount == INIT_VIRTUAL_BALL_PARAMS);
flt3DPoint1.x = (float)params[0];
flt3DPoint1.y = (float)params[1];
flt3DPoint1.z = (float)params[2];
flt3DVector1.x = (float)params[3];
flt3DVector1.y = (float)params[4];
flt3DVector1.z = (float)params[5];
retValue = u32_userInitVirtualBall(flt3DPoint1, flt3DVector1, params[6], params[7]);
break;
case DEINIT_VIRTUAL_BALL:
assert(paramCount == DEINIT_VIRTUAL_BALL_PARAMS);
retValue = u32_userDeinitVirtualBall();
break;
case INIT_PLAYER:
assert(paramCount == INIT_PLAYER_PARAMS);
flt3DPoint1.x = (float)params[1];
flt3DPoint1.y = (float)params[2];
flt3DPoint1.z = (float)params[3];
retValue = u32_userInitPlayer(params[0], flt3DPoint1, params[4], params[5], (params[6] != 0));
break;
case DEINIT_PLAYER:
assert(paramCount == DEINIT_PLAYER_PARAMS);
retValue = u32_userDeinitPlayer(params[0]);
break;
case PLAYER_OFF:
assert(paramCount == PLAYER_OFF_PARAMS);
retValue = u32_userPlayerOff(params[0]);
break;
case PLAYER_ON:
assert(paramCount == PLAYER_ON_PARAMS);
retValue = u32_userPlayerOn(params[0]);
break;
case SET_BALL_LOCATION:
assert(paramCount == SET_BALL_LOCATION_PARAMS);
flt3DPoint1.x = (float)params[0];
flt3DPoint1.y = (float)params[1];
flt3DPoint1.z = (float)params[2];
_vm->_basketball->_court->getBallPtr(params[3])->center = flt3DPoint1;
retValue = 1;
break;
case GET_BALL_LOCATION:
assert(paramCount == GET_BALL_LOCATION_PARAMS);
flt3DPoint1 = _vm->_basketball->_court->getBallPtr(params[0])->center;
writeScummVar(_vm1->VAR_U32_USER_VAR_A, _vm->_basketball->u32FloatToInt(flt3DPoint1.x));
writeScummVar(_vm1->VAR_U32_USER_VAR_B, _vm->_basketball->u32FloatToInt(flt3DPoint1.y));
writeScummVar(_vm1->VAR_U32_USER_VAR_C, _vm->_basketball->u32FloatToInt(flt3DPoint1.z));
retValue = 1;
break;
case SET_PLAYER_LOCATION:
assert(paramCount == SET_PLAYER_LOCATION_PARAMS);
flt3DPoint1.x = (float)params[0];
flt3DPoint1.y = (float)params[1];
flt3DPoint1.z = (float)params[2];
flt3DPoint1.z += (_vm->_basketball->_court->getPlayerPtr(params[3])->height / 2);
_vm->_basketball->_court->getPlayerPtr(params[3])->center = flt3DPoint1;
retValue = 1;
break;
case GET_PLAYER_LOCATION:
assert(paramCount == GET_PLAYER_LOCATION_PARAMS);
flt3DPoint1 = _vm->_basketball->_court->getPlayerPtr(params[0])->center;
flt3DPoint1.z -= (_vm->_basketball->_court->getPlayerPtr(params[0])->height / 2);
writeScummVar(_vm1->VAR_U32_USER_VAR_A, _vm->_basketball->u32FloatToInt(flt3DPoint1.x));
writeScummVar(_vm1->VAR_U32_USER_VAR_B, _vm->_basketball->u32FloatToInt(flt3DPoint1.y));
writeScummVar(_vm1->VAR_U32_USER_VAR_C, _vm->_basketball->u32FloatToInt(flt3DPoint1.z));
retValue = 1;
break;
case DETECT_BALL_COLLISION:
assert(paramCount == DETECT_BALL_COLLISION_PARAMS);
flt3DPoint1.x = (float)params[0];
flt3DPoint1.y = (float)params[1];
flt3DPoint1.z = (float)params[2];
flt3DVector1.x = (float)params[3];
flt3DVector1.y = (float)params[4];
flt3DVector1.z = (float)params[5];
retValue = u32_userDetectBallCollision(flt3DPoint1, flt3DVector1, params[6], params[7]);
break;
case DETECT_PLAYER_COLLISION:
assert(paramCount == DETECT_PLAYER_COLLISION_PARAMS);
flt3DPoint1.x = (float)params[1];
flt3DPoint1.y = (float)params[2];
flt3DPoint1.z = (float)params[3];
flt3DVector1.x = (float)params[4];
flt3DVector1.y = (float)params[5];
flt3DVector1.z = (float)params[6];
retValue = u32_userDetectPlayerCollision(params[0], flt3DPoint1, flt3DVector1, (params[7] != 0));
break;
case GET_LAST_BALL_COLLISION:
assert(paramCount == GET_LAST_BALL_COLLISION_PARAMS);
retValue = u32_userGetLastBallCollision(params[0]);
break;
case GET_LAST_PLAYER_COLLISION:
assert(paramCount == GET_LAST_PLAYER_COLLISION_PARAMS);
retValue = u32_userGetLastPlayerCollision(params[0]);
break;
case DETECT_SHOT_MADE:
assert(paramCount == DETECT_SHOT_MADE_PARAMS);
sphere1.center.x = (float)params[0];
sphere1.center.y = (float)params[1];
sphere1.center.z = (float)params[2];
sphere1.radius = (float)params[6];
int3DVector1.x = params[3];
int3DVector1.y = params[4];
int3DVector1.z = params[5];
retValue = u32_userDetectShotMade(sphere1, int3DVector1, params[7], params[8]);
break;
case RAISE_SHIELDS:
assert(paramCount == RAISE_SHIELDS_PARAMS);
retValue = u32_userRaiseShields(params[0]);
break;
case LOWER_SHIELDS:
assert(paramCount == LOWER_SHIELDS_PARAMS);
retValue = u32_userLowerShields(params[0]);
break;
case FIND_PLAYER_CLOSEST_TO_BALL:
assert((paramCount == 0) || (paramCount == FIND_PLAYER_CLOSEST_TO_BALL_PARAMS));
if (paramCount == 0) {
retValue = u32_userGetPlayerClosestToBall();
} else {
retValue = u32_userGetPlayerClosestToBall(params[0]);
}
break;
case IS_PLAYER_IN_BOUNDS:
assert(paramCount == IS_PLAYER_IN_BOUNDS_PARAMS);
retValue = u32_userIsPlayerInBounds(params[0]);
break;
case IS_BALL_IN_BOUNDS:
assert(paramCount == IS_BALL_IN_BOUNDS_PARAMS);
retValue = u32_userIsBallInBounds();
break;
case ARE_SHIELDS_CLEAR:
assert(paramCount == ARE_SHIELDS_CLEAR_PARAMS);
retValue = u32_userAreShieldsClear();
break;
case SHIELD_PLAYER:
assert(paramCount == SHIELD_PLAYER_PARAMS);
retValue = u32_userShieldPlayer(params[0], params[1]);
break;
case CLEAR_PLAYER_SHIELD:
assert(paramCount == CLEAR_PLAYER_SHIELD_PARAMS);
retValue = u32_userClearPlayerShield(params[0]);
break;
case GET_AVOIDANCE_PATH:
assert(paramCount == GET_AVOIDANCE_PATH_PARAMS);
flt2DPoint1.x = (float)params[1];
flt2DPoint1.y = (float)params[2];
retValue = u32_userGetAvoidancePath(params[0], flt2DPoint1, (EAvoidanceType)params[3]);
break;
case START_BLOCK:
assert(paramCount == START_BLOCK_PARAMS);
assert((FIRST_PLAYER <= params[0]) && (params[0] <= LAST_PLAYER));
(_vm->_basketball->_court->getPlayerPtr(params[0]))->startBlocking(params[1], params[2]);
retValue = 1;
break;
case HOLD_BLOCK:
assert(paramCount == HOLD_BLOCK_PARAMS);
assert((FIRST_PLAYER <= params[0]) && (params[0] <= LAST_PLAYER));
(_vm->_basketball->_court->getPlayerPtr(params[0]))->holdBlocking();
retValue = 1;
break;
case END_BLOCK:
assert(paramCount == END_BLOCK_PARAMS);
assert((FIRST_PLAYER <= params[0]) && (params[0] <= LAST_PLAYER));
(_vm->_basketball->_court->getPlayerPtr(params[0]))->endBlocking();
retValue = 1;
break;
case IS_PLAYER_IN_GAME:
assert(paramCount == IS_PLAYER_IN_GAME_PARAMS);
assert((FIRST_PLAYER <= params[0]) && (params[0] <= LAST_PLAYER));
writeScummVar(_vm1->VAR_U32_USER_VAR_A, ((_vm->_basketball->_court->getPlayerPtr(params[0]))->_playerIsInGame) ? 1 : 0);
retValue = 1;
break;
case IS_BALL_IN_GAME:
assert(paramCount == IS_BALL_IN_GAME_PARAMS);
writeScummVar(_vm1->VAR_U32_USER_VAR_A, ((_vm->_basketball->_court->getBallPtr(params[0]))->_ignore) ? 0 : 1);
retValue = 1;
break;
case UPDATE_CURSOR_POS:
assert(paramCount == UPDATE_CURSOR_POS_PARAMS);
retValue = u32_userUpdateCursorPos(params[0], params[1]);
break;
case MAKE_CURSOR_STICKY:
assert(paramCount == MAKE_CURSOR_STICKY_PARAMS);
retValue = u32_userMakeCursorSticky(params[0], params[1]);
break;
case CURSOR_TRACK_MOVING_OBJECT:
assert(paramCount == CURSOR_TRACK_MOVING_OBJECT_PARAMS);
retValue = u32_userCursorTrackMovingObject(params[0], params[1]);
break;
case GET_CURSOR_POSITION:
assert(paramCount == GET_CURSOR_POSITION_PARAMS);
retValue = u32_userGetCursorPos();
break;
case AI_GET_OPEN_SPOT:
assert(paramCount == AI_GET_OPEN_SPOT_PARAMS);
retValue = u32_userGetOpenSpot(
params[0],
U32FltVector2D((float)params[1], (float)params[2]),
U32FltVector2D((float)params[3], (float)params[4]),
U32FltVector2D((float)params[5], (float)params[6]),
(params[7] != 0),
U32FltVector2D((float)params[8], (float)params[9]));
break;
case AI_GET_OPPONENTS_IN_CONE:
assert(paramCount == AI_GET_OPPONENTS_IN_CONE_PARAMS);
retValue = _vm->_basketball->numOpponentsInCone(
params[0],
(((float)params[1]) / 65536),
U32FltVector2D((float)params[2], (float)params[3]),
U32FltVector2D((float)params[4], (float)params[5]));
break;
case U32_CLEAN_UP_OFF_HEAP:
// No-op
retValue = 1;
break;
default:
break;
}
return retValue;
}
LogicHE *makeLogicHEbasketball(ScummEngine_v100he *vm) {
return new LogicHEBasketball(vm);
}
} // End of namespace Scumm
|