Subversion Repositories Games.Carmageddon

Rev

Rev 1 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #ifndef _OPPONENT_H_
  2. #define _OPPONENT_H_
  3.  
  4. #include "dr_types.h"
  5.  
  6. #define CAR_SPEC_IS_OPPONENT(CAR_SPEC) (VEHICLE_TYPE_FROM_ID((CAR_SPEC)->car_ID) == eVehicle_opponent)
  7. #define CAR_SPEC_IS_ROZZER(CAR_SPEC) (VEHICLE_TYPE_FROM_ID((CAR_SPEC)->car_ID) == eVehicle_rozzer)
  8.  
  9. #define CAR_SPEC_GET_SPEED_FACTOR(CAR_SPEC) (CAR_SPEC_IS_ROZZER(CAR_SPEC) ? gCop_speed_factor : gOpponent_speed_factor)
  10.  
  11. extern br_actor* gOppo_path_actor;
  12. extern br_model* gOppo_path_model;
  13. extern br_material* gMat_dk_yel;
  14. extern br_material* gMat_md_yel;
  15. extern br_material* gMat_lt_yel;
  16. extern br_material* gMat_dk_red;
  17. extern br_material* gMat_lt_red;
  18. extern br_material* gMat_dk_grn;
  19. extern br_material* gMat_lt_grn;
  20. extern br_material* gMat_dk_blu;
  21. extern br_material* gMat_lt_blu;
  22. extern br_material* gMat_dk_turq;
  23. extern br_material* gMat_lt_turq;
  24. extern br_material* gMat_dk_gry;
  25. extern br_material* gMat_md_gry;
  26. extern br_material* gMat_lt_gry;
  27. extern int gMellow_opponents;
  28. extern int gTest_toggle;
  29. extern int gAlready_elasticating;
  30. extern int gVertices_used_in_non_edit_paths;
  31. extern int gFaces_used_in_non_edit_paths;
  32. extern int gMats_allocated;
  33. extern int gOppo_paths_shown;
  34. extern int gMade_path_filename;
  35. extern int gBIG_APC_index;
  36. extern char* gPath_section_type_names[3];
  37. extern int gMin_bangness;
  38. extern int gMax_bangness;
  39. extern tU32 gNext_elastication;
  40. extern tU32 gNext_write_during_elastication;
  41. extern char* gCop_name;
  42. extern char* gDrone_name;
  43. extern int gChallenger_index__opponent; // suffix added to avoid duplicate symbol
  44. extern int gSFS_count;
  45. extern int gSFS_total_cycles;
  46. extern int gSFS_max_cycles;
  47. extern float gOpponent_nastyness_frigger;
  48. extern char gOppo_path_filename[256];
  49. extern br_scalar gIn_view_distance;
  50. extern tU8* gBit_per_node;
  51. extern int gGrudge_reduction_per_period;
  52. extern int gSFS_cycles_this_time;
  53. extern br_scalar gMinimum_yness_before_knackerisation;
  54. extern int gWanky_arse_tit_fuck;
  55. extern br_scalar gHead_on_cos_value;
  56. extern tU32 gNext_grudge_reduction;
  57. extern br_scalar gCop_pursuit_speed_percentage_multiplier;
  58. extern br_scalar gDefinite_cop_pursuit_speed;
  59. extern int gAcknowledged_start;
  60. extern int gStart_jumped;
  61. extern int gNum_of_opponents_getting_near;
  62. extern int gNumber_of_cops_before_faffage;
  63. extern int gFirst_frame;
  64. extern tU32 gAcme_frame_count;
  65. extern br_scalar gDefinite_no_cop_pursuit_speed;
  66. extern int gNum_of_opponents_completing_race;
  67. extern int gNum_of_opponents_pursuing;
  68. extern int gActive_car_list_rebuild_required;
  69. extern br_scalar gFrame_period_for_this_munging_in_secs;
  70. extern int gBig_bang;
  71. extern int gProcessing_opponents;
  72. extern tU32 gFrame_period_for_this_munging;
  73. extern tU32 gTime_stamp_for_this_munging;
  74. extern tS16 gMobile_section;
  75.  
  76. void PointActorAlongThisBloodyVector(br_actor* pThe_actor, br_vector3* pThe_vector);
  77.  
  78. void ProcessCurrentObjective(tOpponent_spec* pOpponent_spec, tProcess_objective_command pCommand);
  79.  
  80. tS16 ReallocExtraPathNodes(int pHow_many_then);
  81.  
  82. tS16 ReallocExtraPathSections(int pHow_many_then);
  83.  
  84. int PointVisibleFromHere(br_vector3* pFrom, br_vector3* pTo);
  85.  
  86. tS16 FindNearestPathNode(br_vector3* pActor_coords, br_scalar* pDistance);
  87.  
  88. tS16 FindNearestPathSection(br_vector3* pActor_coords, br_vector3* pPath_direction, br_vector3* pIntersect, br_scalar* pDistance);
  89.  
  90. tS16 FindNearestGeneralSection(tCar_spec* pPursuee, br_vector3* pActor_coords, br_vector3* pPath_direction, br_vector3* pIntersect, br_scalar* pDistance);
  91.  
  92. void DeadStopCar(tCar_spec* pCar_spec);
  93.  
  94. void TurnOpponentPhysicsOn(tOpponent_spec* pOpponent_spec);
  95.  
  96. void TurnOpponentPhysicsOff(tOpponent_spec* pOpponent_spec);
  97.  
  98. void NewObjective(tOpponent_spec* pOpponent_spec, tOpponent_objective_type pObjective_type, ...);
  99.  
  100. void CalcRaceRoute(tOpponent_spec* pOpponent_spec);
  101.  
  102. void TopUpRandomRoute(tOpponent_spec* pOpponent_spec, int pSections_to_add);
  103.  
  104. int SearchForSection(tRoute_section* pTemp_store, tRoute_section* pPerm_store, int* pNum_of_perm_store_sections, tS16 pTarget_section, int pDepth, br_scalar pDistance_so_far, tOpponent_spec* pOpponent_spec);
  105.  
  106. void CalcGetNearPlayerRoute(tOpponent_spec* pOpponent_spec, tCar_spec* pPlayer);
  107.  
  108. void CalcReturnToStartPointRoute(tOpponent_spec* pOpponent_spec);
  109.  
  110. void ClearOpponentsProjectedRoute(tOpponent_spec* pOpponent_spec);
  111.  
  112. int AddToOpponentsProjectedRoute(tOpponent_spec* pOpponent_spec, tS16 pSection_no, int pDirection);
  113.  
  114. int ShiftOpponentsProjectedRoute(tOpponent_spec* pOpponent_spec, int pPlaces);
  115.  
  116. void StunTheBugger(tOpponent_spec* pOpponent_spec, int pMilliseconds);
  117.  
  118. void UnStunTheBugger(tOpponent_spec* pOpponent_spec);
  119.  
  120. void ProcessCompleteRace(tOpponent_spec* pOpponent_spec, tProcess_objective_command pCommand);
  121.  
  122. void StartRecordingTrail(tCar_spec* pPursuee);
  123.  
  124. void RecordNextTrailNode(tCar_spec* pPursuee);
  125.  
  126. tS16 FindNearestTrailSection(tOpponent_spec* pOpponent_spec, tCar_spec* pPursuee, br_vector3* pSection_v, br_vector3* pIntersect, br_scalar* pDistance);
  127.  
  128. tS16 CalcNextTrailSection(tOpponent_spec* pOpponent_spec, int pSection);
  129.  
  130. void ProcessPursueAndTwat(tOpponent_spec* pOpponent_spec, tProcess_objective_command pCommand);
  131.  
  132. void ProcessRunAway(tOpponent_spec* pOpponent_spec, tProcess_objective_command pCommand);
  133.  
  134. void ProcessWaitForSomeHaplessSod(tOpponent_spec* pOpponent_spec, tProcess_objective_command pCommand);
  135.  
  136. void ProcessReturnToStart(tOpponent_spec* pOpponent_spec, tProcess_objective_command pCommand);
  137.  
  138. void ProcessLevitate(tOpponent_spec* pOpponent_spec, tProcess_objective_command pCommand);
  139.  
  140. void ProcessGetNearPlayer(tOpponent_spec* pOpponent_spec, tProcess_objective_command pCommand);
  141.  
  142. void ProcessFrozen(tOpponent_spec* pOpponent_spec, tProcess_objective_command pCommand);
  143.  
  144. int HeadOnWithPlayerPossible(tOpponent_spec* pOpponent_spec);
  145.  
  146. int AlreadyPursuingCar(tOpponent_spec* pOpponent_spec, tCar_spec* pPursuee);
  147.  
  148. int LastTwatteeAPlayer(tOpponent_spec* pOpponent_spec);
  149.  
  150. int LastTwatterAPlayer(tOpponent_spec* pOpponent_spec);
  151.  
  152. void ObjectiveComplete(tOpponent_spec* pOpponent_spec);
  153.  
  154. void TeleportOpponentToNearestSafeLocation(tOpponent_spec* pOpponent_spec);
  155.  
  156. void ChooseNewObjective(tOpponent_spec* pOpponent_spec, int pMust_choose_one);
  157.  
  158. void ProcessThisOpponent(tOpponent_spec* pOpponent_spec);
  159.  
  160. int IsNetCarActive(br_vector3* pPoint);
  161.  
  162. void RebuildActiveCarList(void);
  163.  
  164. void ForceRebuildActiveCarList(void);
  165.  
  166. void StartToCheat(tOpponent_spec* pOpponent_spec);
  167.  
  168. void OiStopCheating(tOpponent_spec* pOpponent_spec);
  169.  
  170. int TeleportCopToStart(tOpponent_spec* pOpponent_spec);
  171.  
  172. void CalcDistanceFromHome(tOpponent_spec* pOpponent_spec);
  173.  
  174. int MassageOpponentPosition(tOpponent_spec* pOpponent_spec, int pMassage_count);
  175.  
  176. int RematerialiseOpponentOnThisSection(tOpponent_spec* pOpponent_spec, br_scalar pSpeed, tS16 pSection_no);
  177.  
  178. int RematerialiseOpponentOnNearestSection(tOpponent_spec* pOpponent_spec, br_scalar pSpeed);
  179.  
  180. int RematerialiseOpponent(tOpponent_spec* pOpponent_spec, br_scalar pSpeed);
  181.  
  182. void CalcPlayerConspicuousness(tOpponent_spec* pOpponent_spec);
  183.  
  184. void CalcOpponentConspicuousnessWithAViewToCheatingLikeFuck(tOpponent_spec* pOpponent_spec);
  185.  
  186. void ChallengeOccurred(int pChallenger_index, int pAccepted);
  187.  
  188. void LoadCopCars(void);
  189.  
  190. void LoadInOppoPaths(FILE* pF);
  191.  
  192. void DisposeOpponentPaths(void);
  193.  
  194. void MungeOpponents(tU32 pFrame_period);
  195.  
  196. void SetInitialCopPositions(void);
  197.  
  198. void InitOpponents(tRace_info* pRace_info);
  199.  
  200. void DisposeOpponents(void);
  201.  
  202. void WakeUpOpponentsToTheFactThatTheStartHasBeenJumped(int pWhat_the_countdown_was);
  203.  
  204. void ReportMurderToPoliceDepartment(tCar_spec* pCar_spec);
  205.  
  206. int GetCarCount(tVehicle_type pCategory);
  207.  
  208. tCar_spec* GetCarSpec(tVehicle_type pCategory, int pIndex);
  209.  
  210. char* GetDriverName(tVehicle_type pCategory, int pIndex);
  211.  
  212. tOpponent_spec* GetOpponentSpecFromCarSpec(tCar_spec* pCar_spec);
  213.  
  214. tCar_spec* GetCarSpecFromGlobalOppoIndex(int pIndex);
  215.  
  216. int GetOpponentsRealSection(tOpponent_spec* pOpponent_spec, int pSection_no);
  217.  
  218. int GetOpponentsFirstSection(tOpponent_spec* pOpponent_spec);
  219.  
  220. int GetOpponentsNextSection(tOpponent_spec* pOpponent_spec, tS16 pCurrent_section);
  221.  
  222. tS16 GetOpponentsSectionStartNode(tOpponent_spec* pOpponent_spec, tS16 pSection);
  223.  
  224. tS16 GetOpponentsSectionFinishNode(tOpponent_spec* pOpponent_spec, tS16 pSection);
  225.  
  226. br_vector3* GetOpponentsSectionStartNodePoint(tOpponent_spec* pOpponent_spec, tS16 pSection);
  227.  
  228. br_vector3* GetOpponentsSectionFinishNodePoint(tOpponent_spec* pOpponent_spec, tS16 pSection);
  229.  
  230. br_scalar GetOpponentsSectionWidth(tOpponent_spec* pOpponent_spec, tS16 pSection);
  231.  
  232. int GetOpponentsSectionMinSpeed(tOpponent_spec* pOpponent_spec, tS16 pSection, int pTowards_finish);
  233.  
  234. int GetOpponentsSectionMaxSpeed(tOpponent_spec* pOpponent_spec, tS16 pSection, int pTowards_finish);
  235.  
  236. void InitOpponentPsyche(int pOpponent_index);
  237.  
  238. void ClearTwattageOccurrenceVariables(tOpponent_spec* pOpponent_spec);
  239.  
  240. void TwoCarsHitEachOther(tCar_spec* pA_car, tCar_spec* pAnother_car);
  241.  
  242. void RecordOpponentTwattageOccurrence(tCar_spec* pTwatter, tCar_spec* pTwattee);
  243.  
  244. void ToggleOpponentTest(void);
  245.  
  246. void ToggleOpponentProcessing(void);
  247.  
  248. void ToggleMellowOpponents(void);
  249.  
  250. void RepairOpponentsSystems(void);
  251.  
  252. void CopyVertex__opponent(br_vertex* pDest_vertex, br_vertex* pSrc_vertex);
  253.  
  254. void CopyFace__opponent(br_face* pDest_face, br_face* pSrc_face);
  255.  
  256. void DeleteSection(tS16 pSection_to_delete);
  257.  
  258. void DeleteNode(tS16 pNode_to_delete, int pAnd_sections);
  259.  
  260. void DeleteOrphanNodes(void);
  261.  
  262. void InsertThisNodeInThisSectionHere(tS16 pInserted_node, tS16 pSection_no, br_vector3* pWhere);
  263.  
  264. void TrackElasticateyPath(void);
  265.  
  266. void RecalcNearestPathSectionSpeed(int pMax_not_min, int pAdjustment);
  267.  
  268. void RecalcNearestPathSectionWidth(br_scalar pAdjustment);
  269.  
  270. void CalcNegativeXVector(br_vector3* pNegative_x_vector, br_vector3* pStart, br_vector3* pFinish, br_scalar pLength);
  271.  
  272. void MakeVertexAndOffsetIt(br_model* pModel, int pVertex_num, br_scalar pX, br_scalar pY, br_scalar pZ, br_vector3* pOffset);
  273.  
  274. void MakeFaceAndTextureIt(br_model* pModel, int pFace_num, int pV0, int pV1, int pV2, br_material* pMaterial);
  275.  
  276. void MakeSection(br_uint_16 pFirst_vertex, br_uint_16 pFirst_face, br_vector3* pStart, br_vector3* pFinish, br_scalar pWidth, br_material* pMaterial_centre_lt, br_material* pMaterial_centre_dk, br_material* pMaterial_edges_start_lt, br_material* pMaterial_edges_start_dk, br_material* pMaterial_edges_finish_lt, br_material* pMaterial_edges_finish_dk);
  277.  
  278. void MakeCube(br_uint_16 pFirst_vertex, br_uint_16 pFirst_face, br_vector3* pPoint, br_material* pMaterial_1, br_material* pMaterial_2, br_material* pMaterial_3);
  279.  
  280. void CalcNumberOfFacesAndVerticesForOppoPathModel(br_uint_16* pFace_index_ptr, br_uint_16* pVertex_index_ptr);
  281.  
  282. void ReallocModelFacesAndVertices(br_model* pModel, int pNum_faces, int pNum_vertices);
  283.  
  284. br_material* CreateSimpleMaterial(int pColour_index);
  285.  
  286. void AllocateMatsForOppoPathModel(void);
  287.  
  288. void RebuildOppoPathModel(void);
  289.  
  290. int ConsistencyCheck(void);
  291.  
  292. void ShowOppoPaths(void);
  293.  
  294. void WriteOutOppoPaths(void);
  295.  
  296. int NewNodeOKHere(void);
  297.  
  298. void ShowHideOppoPaths(void);
  299.  
  300. void DropElasticateyNode(void);
  301.  
  302. void InsertAndElasticate(void);
  303.  
  304. void InsertAndDontElasticate(void);
  305.  
  306. void DropDeadEndNode(void);
  307.  
  308. void DropNodeOnNodeAndStopElasticating(void);
  309.  
  310. void WidenOppoPathSection(void);
  311.  
  312. void NarrowOppoPathSection(void);
  313.  
  314. void IncreaseSectionMinSpeed(void);
  315.  
  316. void DecreaseSectionMinSpeed(void);
  317.  
  318. void IncreaseSectionMaxSpeed(void);
  319.  
  320. void DecreaseSectionMaxSpeed(void);
  321.  
  322. void PullOppoPoint(void);
  323.  
  324. void ShowNodeInfo(void);
  325.  
  326. void ShowSectionInfo1(void);
  327.  
  328. void ShowSectionInfo2(void);
  329.  
  330. void DeleteOppoPathSection(void);
  331.  
  332. void DeleteOppoPathNodeAndSections(void);
  333.  
  334. void DeleteOppoPathNodeAndJoin(void);
  335.  
  336. void ReverseSectionDirection(void);
  337.  
  338. void CycleSectionType(void);
  339.  
  340. void ToggleOneWayNess(void);
  341.  
  342. void CopStartPointInfo(void);
  343.  
  344. void DropCopStartPoint(void);
  345.  
  346. void DeleteCopStartPoint(void);
  347.  
  348. void CycleCopStartPointType(void);
  349.  
  350. #endif
  351.