iltclient.h 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137
  1. #ifndef __ILTCLIENT_H__
  2. #define __ILTCLIENT_H__
  3. #include "ltbasedefs.h"
  4. #include "iclientshell.h"
  5. #include "iltcommon.h"
  6. #include "iltcsbase.h"
  7. #include "iltsoundmgr.h"
  8. #include "iltdirectmusic.h"
  9. // Particle system flags. Each one slows it down a little more
  10. // except for PS_NEVERDIE which speeds it up..
  11. #define PS_BOUNCE (1<<0) // Do they bounce?
  12. #define PS_NEVERDIE (1<<2) // The particles never die (and it doesn't have to check).
  13. #define PS_DUMB (1<<3) // The engine leaves the system alone.. you must
  14. // update and move them.
  15. // The particle structure for particle systems.
  16. struct LTParticle
  17. {
  18. LTVector m_Velocity;
  19. LTVector m_Color; // Particle colors are 0-255.
  20. float m_Alpha; // 0-1.
  21. float m_Size; // Particle size
  22. LTParticle *m_pNext;
  23. };
  24. // The line structure for line system.
  25. struct LTLinePt
  26. {
  27. LTVector m_Pos;
  28. float r, g, b, a; // Values 0-1.
  29. };
  30. struct LTLine
  31. {
  32. LTLinePt m_Points[2];
  33. };
  34. DEFINE_HANDLE_TYPE(HLTLINE)
  35. // Music info
  36. #define MUSIC_IMMEDIATE 0
  37. #define MUSIC_NEXTMEASURE 1
  38. #define MUSIC_NEXTSONG 2
  39. #define MUSIC_QUEUE 3
  40. class CSoundInstance;
  41. class ILTSpriteControl;
  42. class ILTLightAnim;
  43. class ILTTexMod;
  44. class ILTClientPhysics;
  45. class ILTVideoMgr;
  46. class ILTModel;
  47. class ILTTransform;
  48. class ILTCursor;
  49. class ILTClientSoundMgr;
  50. class ILTDirectMusicMgr;
  51. // ------------------------------------------------------------------ //
  52. // ILTClient interface. This is what the ClientShells and special
  53. // effect plugins use to do the interface and client objects for the game.
  54. // ------------------------------------------------------------------ //
  55. class ILTClient : public ILTCSBase
  56. {
  57. friend class CClientMgr;
  58. protected:
  59. virtual ~ILTClient() {}
  60. public:
  61. // Access to the other interfaces.
  62. ILTVideoMgr* VideoMgr() {return m_pVideoMgr;}
  63. ILTTexMod* GetTexMod() {return m_pTexMod;}
  64. ILTCursor* Cursor() {return m_pCursorLT;}
  65. ILTDirectMusicMgr* GetDirectMusicMgr() {return m_pDirectMusicMgr;};
  66. // Connection stuff.
  67. // Tries to start the game in the mode you specify.
  68. // This will keep the existing game running until it successfully starts
  69. // the new game.. ie: if there's an error starting the new world, it
  70. // will still leave the current one running and put up an error message.
  71. LTRESULT (*StartGame)(StartGameRequest *pRequest);
  72. // Find out what the current game mode is (how we started the last
  73. // game with StartGame or thru the console). Fills in mode with
  74. // one of the STARTGAME_ defines above.
  75. LTRESULT (*GetGameMode)(int *mode);
  76. // Gets the local client ID.
  77. // Returns LT_NOTCONNECTED if we're not on a server or haven't
  78. // gotten a client ID yet.
  79. LTRESULT (*GetLocalClientID)(uint32 *pID);
  80. LTBOOL (*IsConnected)(); // Are we on a server currently?
  81. // Disconnect from the server we're on (if any).
  82. // NOTE: this will destroy any client-side objects you've created!
  83. void (*Disconnect)();
  84. // Shuts down the app (not right away, but after the current update).
  85. void (*Shutdown)();
  86. // Shuts down the app (not right away, but after the current update).
  87. void (*ShutdownWithMessage)( char *pMsg, ... );
  88. // OBSOLETE: use the CommonDE one.
  89. virtual LTRESULT GetPointStatus(LTVector *pPoint)=0;
  90. // Get the shade (RGB, 0-255) at the point you specify.
  91. // Returns LT_NOTINWORLD if the point is outside the world.
  92. virtual LTRESULT GetPointShade(LTVector *pPoint, LTVector *pColor)=0;
  93. // Renderer management.
  94. // Flip the screen. Flags are a combination of FLIPSCREEN_ flags in de_codes.
  95. // Returns LT_OK or LT_NOTINITIALIZED.
  96. LTRESULT (*FlipScreen)(uint32 flags);
  97. // Clear the backbuffer. Pass in NULL to clear the whole screen.
  98. // Flags is a combination of the CLEARSCREEN_ flags in de_codes.h.
  99. // Returns LT_OK or LT_NOTINITIALIZED.
  100. LTRESULT (*ClearScreen)(LTRect *pClearRect, uint32 flags);
  101. // You must be in a Start3D()/End3D() block in order to render
  102. // through any cameras.
  103. // Returns LT_OK or LT_NOTINITIALIZED or LT_ALREADYIN3D.
  104. LTRESULT (*Start3D)();
  105. // Render from the camera's position into its rectangle.
  106. // Returns LT_OK or LT_NOTINITIALIZED or LT_NOTIN3D.
  107. LTRESULT (*RenderCamera)(HLOCALOBJ hCamera);
  108. // Renders the list of objects through the given camera.
  109. // Returns LT_OK or LT_NOTINITIALIZED or LT_NOTIN3D.
  110. LTRESULT (*RenderObjects)(HLOCALOBJ hCamera, HLOCALOBJ *pObjects, int nObjects);
  111. // You must be in a StartOptimized2D()/EndOptimized2D() block to draw any optimized 2D surfaces.
  112. LTRESULT (*StartOptimized2D)();
  113. LTRESULT (*EndOptimized2D)();
  114. // Change the src/dest blend mode for rendering Optimized2D surfaces (Defaults to LTSURFACEBLEND_ALPHA)
  115. // Note : Drawing a surface w/ a blend mode other than _ALPHA will automatically optimize the surface
  116. LTRESULT (*SetOptimized2DBlend)(LTSurfaceBlend blend);
  117. LTRESULT (*GetOptimized2DBlend)(LTSurfaceBlend &blend);
  118. // Change the color used on Optimized2D surfaces (i.e. apply a color filter to Optimized2D)
  119. LTRESULT (*SetOptimized2DColor)(HLTCOLOR hColor);
  120. LTRESULT (*GetOptimized2DColor)(HLTCOLOR &hColor);
  121. // Returns LT_OK or LT_NOTINITIALIZED or LT_NOTIN3D.
  122. LTRESULT (*End3D)();
  123. // Get a (NULL-terminated) list of supported render modes.
  124. RMode* (*GetRenderModes)();
  125. void (*RelinquishRenderModes)(RMode *pModes);
  126. // Fills in the current render mode.
  127. LTRESULT (*GetRenderMode)(RMode *pMode);
  128. // Goes into the requested render mode.
  129. // Returns LT_OK if successful. Note: it may not have set the _exact_ mode you
  130. // requested. You can check with GetRenderMode() to see what the new mode is.
  131. // Returns LT_KEPTSAMEMODE if it couldn't set the mode requested, but
  132. // was able to restore the previous mode.
  133. // Returns LT_UNABLETORESTOREVIDEO if it couldn't set the mode and couldn't
  134. // restore the video mode (in which case it will give a message and shutdown
  135. // afterwards).
  136. LTRESULT (*SetRenderMode)(RMode *pMode);
  137. // Shutdown the renderer. flags is a combination of the RSHUTDOWN_ flags in de_codes.h.
  138. // The renderer won't come back until you call SetRenderMode().
  139. LTRESULT (*ShutdownRender)(uint32 flags);
  140. // File management.
  141. // Get a list of files/directories in a directory (pass in "" to start with).
  142. // The list is a noncircular linked list with LTNULL terminating it.
  143. FileEntry* (*GetFileList)(char *pDirName);
  144. // Use FreeFileList when you're done with each list you get.
  145. void (*FreeFileList)(FileEntry *pHead);
  146. // Get the world info string from the World Info dialog in DEdit.
  147. // Returns LT_NOTFOUND if it can't open the file and LT_INVALIDWORLDFILE
  148. // if the file is an invalid version.
  149. LTRESULT (*GetWorldInfoString)(char *pFilename, char *pInfoString, uint32 maxLen, uint32 *pActualLen);
  150. // Read/write configuration files. Returns LT_ERROR if the file doesn't exist
  151. // or if it can't open the file for writing.
  152. LTRESULT (*ReadConfigFile)(char *pFilename);
  153. LTRESULT (*WriteConfigFile)(char *pFilename);
  154. // Interface stuff.
  155. // offsets is NUM_AXIS_OFFSETS large.
  156. void (*GetAxisOffsets)(LTFLOAT *offsets);
  157. void (*PlayJoystickEffect)(char *pEffectName, float x, float y);
  158. // Music functions.
  159. LTBOOL (*InitMusic)( char *szMusicDLL );
  160. // Sets the directory to find music data files.
  161. // IMA only.
  162. LTBOOL (*SetMusicDirectory)( char *szMusicDirectory );
  163. // Downloads DLS.
  164. // szDLSFile is the Downloadable Synthizer file containing the waves for
  165. // instruments. szStyleFile is a style file, that is a compainion to the
  166. // DLS file. It must contain bands that define the program changes for
  167. // each instrument in DLS...
  168. // IMA only.
  169. LTBOOL (*InitInstruments)( char *szDLSFile, char *szStyleFile );
  170. // Cache in a song file.
  171. LTBOOL (*LoadSong)(char *szSong);
  172. // Remove all the songs from memory...
  173. void (*DestroyAllSongs)();
  174. // Plays a playlist. All songs will be played until end of list.
  175. // Arguments:
  176. // szPlayList - Name of playlist.
  177. // szTransition - Name of transition song to play before playlist starts. IMA only.
  178. // bLoop - Loop the list.
  179. // dwBoundaryFlags - Can be MUSIC_IMMEDIATE, MUSIC_MEASURE, MUSIC_SONG, MUSIC_QUEUE. Valid for IMA only.
  180. LTBOOL (*PlayList)( char *szPlayList, char *szTransition, LTBOOL bLoop, uint32 dwBoundaryFlags );
  181. // Plays a musical break.
  182. // IMA only.
  183. // Arguments:
  184. // szSong - Name of song.
  185. // dwBoundaryFlags - Can be MUSIC_IMMEDIATE, MUSIC_MEASURE, MUSIC_SONG, MUSIC_QUEUE. Valid for IMA only.
  186. LTBOOL (*PlayBreak)( char *szSong, uint32 dwBoundaryFlags );
  187. // Stops music.
  188. // Arguments:
  189. // dwBoundaryFlags - Can be MUSIC_IMMEDIATE, MUSIC_MEASURE, MUSIC_SONG, MUSIC_QUEUE. Valid for IMA only.
  190. void (*StopMusic)( uint32 dwBoundaryFlags );
  191. // Pause music. Can be resumed...
  192. LTBOOL (*PauseMusic)();
  193. // Resume music...
  194. LTBOOL (*ResumeMusic)();
  195. // Create and add to playlists....
  196. // Arguments:
  197. // szPlayList - Name of playlist.
  198. // szSong - Name of song to add.
  199. LTBOOL (*AddSongToPlayList)(char *szPlayList, char *szSong);
  200. // Removes a whole playlist...
  201. // Arguments:
  202. // szPlayList - Name of playlist.
  203. void (*DeletePlayList)(char *szPlayList);
  204. // Plays a motif.
  205. // Ima only.
  206. // Arguments:
  207. // szMotif - name of motif.
  208. // bLoop - Loop the motif.
  209. LTBOOL (*PlayMotif)(char *szMotif, LTBOOL bLoop);
  210. // Stops a motif for IMA.
  211. // IMA only.
  212. // Arguments:
  213. // szMotif - name of motif.
  214. void (*StopMotif)(char *szMotif);
  215. // Volume range is 0-off, 100-full.
  216. short (*GetMusicVolume)();
  217. void (*SetMusicVolume)( short wVolume );
  218. // Sound functions.
  219. // Gets a list of the 3d sound providers available on system. Choose one, pass it in the
  220. // InitSoundInfo structure. Use bVerify to tell the engine not to report providers that
  221. // aren't completely supported on the system. This takes longer and causes speaker popping.
  222. // Games should only need to do this when a different provider is chosen. EAX support
  223. // can only be checked when the provider is opened, so without the bVerify, the
  224. // SOUND3DPROVIDER_CAPS_REVERB cannot be set. InitSound will report this info in the
  225. // m_dwResults flags.
  226. // Be sure to release the list with ReleaseSound3DProviderList.
  227. LTRESULT (*GetSound3DProviderLists)( Sound3DProvider *&pSound3DProviderList, LTBOOL bVerify );
  228. void (*ReleaseSound3DProviderList)( Sound3DProvider *pSound3DProviderList );
  229. // Initializes the sound driver.
  230. LTRESULT (*InitSound)( InitSoundInfo *pSoundInfo );
  231. // Volume controls between 0 - 100
  232. unsigned short ( *GetSoundVolume )();
  233. void ( *SetSoundVolume )( unsigned short nVolume );
  234. // Controls the reverb properties.
  235. // Inputs:
  236. LTRESULT ( *SetReverbProperties )( ReverbProperties *pReverbProperties );
  237. LTRESULT ( *GetReverbProperties )( ReverbProperties *pReverbProperties );
  238. // These PlaySound function allows the client shell to initiate and control sounds
  239. // without going through the server. These sounds will only be played
  240. // on the client initiating them. These functions will fill m_hSound
  241. // with the handle to the client sound if you set the PLAYSOUND_GETHANDLE flag. This will
  242. // also force the sound not to be automatically deleted when the sound is done playing. You
  243. // must call KillSound. You must get the handle in order to use the other sound functions
  244. // like SetSoundPosition.
  245. // Play a sound with full control
  246. // Arguments:
  247. // pPlaySoundInfo - sound control structure
  248. // Return:
  249. // Handle to the client only sound.
  250. LTRESULT (*PlaySound)( PlaySoundInfo *pPlaySoundInfo );
  251. // Update position and orientation of a client only sound.
  252. // Arguments:
  253. // hSound - Handle to client only sound.
  254. // pPos - New position of sound. Can be NULL.
  255. // Return:
  256. // LT_OK - Successful.
  257. // LT_INVALIDPARAM - Invalid parameters.
  258. // LT_ERROR - Unable find hSound
  259. LTRESULT (*SetSoundPosition)( HLTSOUND hSound, LTVector *pPos );
  260. // Get current position and orientation of a client only sound.
  261. // Arguments:
  262. // hSound - Handle to client only sound.
  263. // pPos - Destination of position. Can be NULL.
  264. // pOrientation - Destination of orientation. Can be NULL.
  265. // Return:
  266. // LT_OK - Successful.
  267. // LT_INVALIDPARAM - Invalid parameters.
  268. // LT_ERROR - Unable to find hSound.
  269. LTRESULT (*GetSoundPosition)( HLTSOUND hSound, LTVector *pPos );
  270. // Pause/resume sounds.
  271. void (*PauseSounds)( );
  272. void (*ResumeSounds)( );
  273. // Get total length in seconds of sound.
  274. // Arguments:
  275. // hSound - Handle to sound.
  276. // fDuration - Duration of sound.
  277. // Returns:
  278. // LT_OK if successful.
  279. // LT_INVALIDPARAMS if hSound not available.
  280. LTRESULT (*GetSoundDuration)( HLTSOUND hSound, LTFLOAT *fDuration );
  281. // Get current time in seconds of sound.
  282. // Arguments:
  283. // hSound - Handle to sound.
  284. // fTimer - Current time of sound.
  285. // Returns:
  286. // LT_OK if successful, fTimer is set only if this is returned.
  287. // LT_FINISHED if sound is not playing (may be delayed due to collisions).
  288. // LT_INVALIDPARAMS if hSound not available.
  289. LTRESULT (*GetSoundTimer)( HLTSOUND hSound, LTFLOAT *fTimer );
  290. // Get the sound data and information about the data.
  291. // This will force the sound to be decompressed.
  292. //
  293. // Arguments:
  294. // hSound - Handle to sound.
  295. // pSixteenBitData - Set to data buffer if buffer is 16 bits per sample, else set to NULL.
  296. // pSixteenBitData - Set to data buffer if buffer is 8 bits per sample, else set to NULL.
  297. // dwSamplesPerSecond - Set to samples per second.
  298. // dwChannels - Set to number of channels. (samples alternate between each channel).
  299. //
  300. // Returns:
  301. // LT_OK if successful, fTimer is set only if this is returned.
  302. // LT_ERROR if sound is neither 8 nor 16 bit format.
  303. // LT_INVALIDPARAMS if hSound not available.
  304. LTRESULT (*GetSoundData)( HLTSOUND hSound,
  305. int16 * & pSixteenBitData, int8 * & pEightBitData,
  306. uint32 * dwSamplesPerSecond, uint32 * dwChannels );
  307. // Get current offset into sound buffer of sound.
  308. //
  309. // Arguments:
  310. // hSound - Handle to sound.
  311. // dwOffset - Current offset into sound buffer (in buffer increments, bytes if 8 bit, double bytes if 16 bit).
  312. // dwSize - Size of sound buffer (in bytes).
  313. // Returns:
  314. // LT_OK if successful, fTimer is set only if this is returned.
  315. // LT_FINISHED if sound is not playing (may be delayed due to collisions, or done).
  316. // LT_INVALIDPARAMS if hSound not available.
  317. LTRESULT (*GetSoundOffset)( HLTSOUND hSound, uint32 * dwOffset, uint32 * dwSize = NULL );
  318. // Check if sound finished playing or if object it was attached to was removed.
  319. // Arguments:
  320. // pSoundHandle - handle to client only sound
  321. LTBOOL (*IsDone)( HLTSOUND pSoundHandle );
  322. // Kill a sound.
  323. // Arguments:
  324. // pSoundHandle - handle to client only sound
  325. void (*KillSound)( HLTSOUND pSoundHandle );
  326. // Kills a looping sound. Sound will continue to play until it reaches
  327. // the end, then remove itself.
  328. // Arguments:
  329. // hSoundHandle - handle to client side sound.
  330. void (*KillSoundLoop)( HLTSOUND hSoundHandle );
  331. // Set the listener status, position and orientation. If bListenerInClient is TRUE, then
  332. // pPos and pRot are ignored and can be set to NULL.
  333. void (*SetListener)( LTBOOL bListenerInClient, LTVector *pPos, LTRotation *pRot );
  334. // Return results of above function
  335. void (*GetListener)( LTBOOL *bListenerInClient, LTVector *pPos, LTRotation *pRot );
  336. // Intersections.
  337. // Intersect a line segment.. (used to be raycast, but line segments are WAY faster).
  338. // Returns TRUE and fills in pInfo if it hit something.
  339. LTBOOL (*IntersectSegment)(ClientIntersectQuery *pQuery, ClientIntersectInfo *pInfo);
  340. // Same as IntersectSegment, except for it casts a ray from pQuery->m_From
  341. // in the direction of pQuery->m_Dir.
  342. LTBOOL (*CastRay)(ClientIntersectQuery *pQuery, ClientIntersectInfo *pInfo);
  343. // Find objects in a sphere. This is only based on their centerpoints, not
  344. // on their dimensions or anything. inObjects is filled in and nOutObjects
  345. // is set to the number of objects filled in. nFound might be larger if
  346. // it found more objects than nInObjects.
  347. LTRESULT (*FindObjectsInSphere)(LTVector *pCenter, float radius,
  348. HLOCALOBJ *inObjects, uint32 nInObjects, uint32 *nOutObjects, uint32 *nFound);
  349. // Fonts..
  350. // Creates the closest font it can to the one you asked for.
  351. HLTFONT (*CreateFont)(char *pFontName, int width, int height,
  352. LTBOOL bItalic, LTBOOL bUnderline, LTBOOL bBold);
  353. void (*DeleteFont)(HLTFONT hFont);
  354. // Sets the amount of extra space inbetween the letters of the text (in pixels)
  355. LTRESULT (*SetFontExtraSpace)(HLTFONT hFont, int pixels);
  356. LTRESULT (*GetFontExtraSpace)(HLTFONT hFont, int &pixels);
  357. // Colors..
  358. // r, g, and b go from 0 to 1.
  359. // bTransparent is only used when the function specifies so.
  360. // Note: anywhere you can pass a color, if you pass in NULL, it'll use black.
  361. HLTCOLOR (*CreateColor)(float r, float g, float b, LTBOOL bTransparent);
  362. void (*DeleteColor)(HLTCOLOR hColor);
  363. // Just for convenience. You don't have to create/delete these colors,
  364. // and they're always around!
  365. HLTCOLOR (*SetupColor1)(float r, float g, float b, LTBOOL bTransparent);
  366. HLTCOLOR (*SetupColor2)(float r, float g, float b, LTBOOL bTransparent);
  367. // Surface management.
  368. // Note: All the rectangles you specify in here do not include the right and bottom
  369. // edges. ie: If you draw a rectangle (0, 1, 0, 1), it'll draw 1 pixel
  370. // instead of 4 pixels.
  371. // Note: Try to use the screen surface as little as possible. Using the screen
  372. // surface stalls ALL asynchronous rendering performance and can cut framerate
  373. // in half on some cards. That's not to say don't use them in the interface,
  374. // just don't use them for things that are always there like frag counts, etc..
  375. // The only functions that don't stall async performance (feel free to use
  376. // these regularly) are:
  377. // DrawSurfaceToSurface
  378. // DrawSurfaceToSurfaceTransparent
  379. // ScaleSurfaceToSurface
  380. // ScaleSurfaceToSurfaceTransparent
  381. // This goes around the edges of the surface and returns the smallest inside
  382. // rectangle allowing for a border of hColor. For example, if hSurface
  383. // had a black border of 2 pixels on the left and right and a black border
  384. // of 3 pixels on the top and bottom, pRect would be set to (2,3,2,3).
  385. LTRESULT (*GetBorderSize)(HSURFACE hSurface, HLTCOLOR hColor, LTRect *pRect);
  386. // Any surfaces you use while rendering 3D stuff at the same time should be optimized
  387. // with this function and drawn in an StartOptimized2D/EndOptimized2D block.
  388. // You need to call OptimizeSurface each time you change its contents.
  389. LTRESULT (*OptimizeSurface)(HSURFACE hSurface, HLTCOLOR hTransparentColor);
  390. LTRESULT (*UnoptimizeSurface)(HSURFACE hSurface);
  391. HSURFACE (*GetScreenSurface)();
  392. // Creates a surface sized to the dimensions of the bitmap.
  393. // The bitmap is an 8-bit (you can use any palette you want..) PCX file.
  394. // So pBitmapName might look like "interface/bitmaps/menu1.pcx".
  395. HSURFACE (*CreateSurfaceFromBitmap)(char *pBitmapName);
  396. // Creates a surface just large enough for the string.
  397. // You can make the surface a little larger with extraPixelsX and extraPixelsY.
  398. HSURFACE (*CreateSurfaceFromString)(HLTFONT hFont, HSTRING hString,
  399. HLTCOLOR hForeColor, HLTCOLOR hBackColor,
  400. int extraPixelsX, int extraPixelsY);
  401. // Create a plain old surface.
  402. HSURFACE (*CreateSurface)(uint32 width, uint32 height);
  403. LTRESULT (*DeleteSurface)(HSURFACE hSurface);
  404. // Attach whatever user data you want to a surface.
  405. void* (*GetSurfaceUserData)(HSURFACE hSurface);
  406. void (*SetSurfaceUserData)(HSURFACE hSurface, void *pUserData);
  407. // Access the pixels (SLOW).
  408. LTRESULT (*GetPixel)(HSURFACE hSurface, uint32 x, uint32 y, HLTCOLOR *color);
  409. LTRESULT (*SetPixel)(HSURFACE hSurface, uint32 x, uint32 y, HLTCOLOR color);
  410. // Gets the dimensions that this string would take up.
  411. void (*GetStringDimensions)(HLTFONT hFont, HSTRING hString, int *sizeX, int *sizeY);
  412. // Draws the string into the rectangle..
  413. void (*DrawStringToSurface)(HSURFACE hDest, HLTFONT hFont, HSTRING hString,
  414. LTRect *pRect, HLTCOLOR hForeColor, HLTCOLOR hBackColor);
  415. // You can pass in NULL for pWidth and pHeight if you want.
  416. void (*GetSurfaceDims)(HSURFACE hSurf, uint32 *pWidth, uint32 *pHeight);
  417. // Draw a bitmap to a surface..
  418. LTBOOL (*DrawBitmapToSurface)(HSURFACE hDest, char *pSourceBitmapName,
  419. LTRect *pSrcRect, int destX, int destY);
  420. // Draws hSrc to hDest like a normal transparent blit, but tiles hMask's surface
  421. // into the nontransparent pixels of hSrc (can you say airbrushed text?)
  422. // You can't have a mask texture larger than 256x256, and the mask must be
  423. // a power of 2.
  424. LTRESULT (*DrawSurfaceMasked)(HSURFACE hDest, HSURFACE hSrc, HSURFACE hMask,
  425. LTRect *pSrcRect, int destX, int destY, HLTCOLOR hColor);
  426. // Draws hSrc onto hDest, but fills in the nontransparent pixels with the
  427. // color you specify.
  428. LTRESULT (*DrawSurfaceSolidColor)(HSURFACE hDest, HSURFACE hSrc,
  429. LTRect *pSrcRect, int destX, int destY, HLTCOLOR hTransColor, HLTCOLOR hFillColor);
  430. // Draws the source surface onto the dest surface. You can specify a rectangle
  431. // in the source surface and the destination coordinates on the destination
  432. // surface.. it doesn't scale the bitmap.. If you pass in NULL for the source
  433. // rect, it'll just use the whole thing.
  434. LTRESULT (*DrawSurfaceToSurface)(HSURFACE hDest, HSURFACE hSrc,
  435. LTRect *pSrcRect, int destX, int destY);
  436. LTRESULT (*DrawSurfaceToSurfaceTransparent)(HSURFACE hDest, HSURFACE hSrc,
  437. LTRect *pSrcRect, int destX, int destY, HLTCOLOR hColor);
  438. // Scales the source surface rectangle into the dest rectangle..
  439. LTRESULT (*ScaleSurfaceToSurface)(HSURFACE hDest, HSURFACE hSrc,
  440. LTRect *pDestRect, LTRect *pSrcRect);
  441. LTRESULT (*ScaleSurfaceToSurfaceTransparent)(HSURFACE hDest, HSURFACE hSrc,
  442. LTRect *pDestRect, LTRect *pSrcRect, HLTCOLOR hColor);
  443. LTRESULT (*ScaleSurfaceToSurfaceSolidColor)(HSURFACE hDest, HSURFACE hSrc,
  444. LTRect *pDestRect, LTRect *pSrcRect, HLTCOLOR hTransColor, HLTCOLOR hFillColor);
  445. // (Affine) warps the source poly into the dest poly. The source
  446. // coordinates are CLAMPED to be inside the source surface's rectangle, and
  447. // the warp is clipped against the destination rectangle (ie: don't specify
  448. // coordinates outside the source rectangle, but feel free to specify them
  449. // outside the destination rectangle). The polygon you specify should be
  450. // convex. The minimum number of coordinates is 3 and the maximum
  451. // is 10.
  452. LTRESULT (*WarpSurfaceToSurface)(HSURFACE hDest, HSURFACE hSrc,
  453. LTWarpPt *pCoords, int nCoords);
  454. LTRESULT (*WarpSurfaceToSurfaceTransparent)(HSURFACE hDest, HSURFACE hSrc,
  455. LTWarpPt *pCoords, int nCoords, HLTCOLOR hColor);
  456. LTRESULT (*WarpSurfaceToSurfaceSolidColor)(HSURFACE hDest, HSURFACE hSrc,
  457. LTWarpPt *pCoords, int nCoords, HLTCOLOR hTransColor, HLTCOLOR hFillColor);
  458. // Transform the source surface onto the dest surface. The origin is
  459. // in the destination surface's coordinates. If you specify NULL, it will
  460. // use the centerpoint as the origin.
  461. LTRESULT (*TransformSurfaceToSurface)(HSURFACE hDest, HSURFACE hSrc,
  462. LTFloatPt *pOrigin, int destX, int destY, float angle,
  463. float scaleX, float scaleY);
  464. LTRESULT (*TransformSurfaceToSurfaceTransparent)(HSURFACE hDest, HSURFACE hSrc,
  465. LTFloatPt *pOrigin, int destX, int destY, float angle,
  466. float scaleX, float scaleY, HLTCOLOR hColor);
  467. // Draw a filled rectangle into the surface.
  468. LTRESULT (*FillRect)(HSURFACE hDest, LTRect *pRect, HLTCOLOR hColor);
  469. // Get/set surface alpha (values 0-1, default 1).
  470. // Note: alpha is only used on optimized surfaces, and only when they are
  471. // blitted to the screen.
  472. LTRESULT (*GetSurfaceAlpha)(HSURFACE hSurface, float &alpha);
  473. LTRESULT (*SetSurfaceAlpha)(HSURFACE hSurface, float alpha);
  474. // Access to client console variables...
  475. // Register a console program. pName is just stored so it should either be
  476. // static or allocated. When the client shell DLL is unloaded, it gets
  477. // rid of any registered programs.
  478. // Returns LT_OK or LT_ALREADYEXISTS.
  479. LTRESULT (*RegisterConsoleProgram)(char *pName, ConsoleProgramFn fn);
  480. // Returns LT_OK or LT_NOTFOUND.
  481. LTRESULT (*UnregisterConsoleProgram)(char *pName);
  482. // Returns NULL if the parameter doesn't exist.
  483. HCONSOLEVAR (*GetConsoleVar)(char *pName);
  484. // Access to server console mirror variables...
  485. // The 'new' accessors for server console variables. Returns LT_NOTFOUND
  486. // if the variable isn't found.
  487. virtual LTRESULT GetSConValueFloat(char *pName, float &val)=0;
  488. virtual LTRESULT GetSConValueString(char *pName, char *valBuf, uint32 bufLen)=0;
  489. // Gets the value of a parameter .. returns 0/NULL if you pass in NULL.
  490. // OBSOLETE (will be removed soon). Use the GetSCon functions.
  491. virtual float GetServerConVarValueFloat(char *pName)=0;
  492. virtual char* GetServerConVarValueString(char *pName)=0;
  493. // Helpers..
  494. // Use these to time sections of code. Timing is done in microseconds
  495. // (1,000,000 counts per second).
  496. void (*StartCounter)(LTCounter *pCounter);
  497. uint32 (*EndCounter)(LTCounter *pCounter);
  498. // Setup the panning sky stuff. Pass in LTNULL for the filename if you want
  499. // to disable the panning sky. Returns LT_NOTFOUND if it can't find
  500. // the texture.
  501. // index tells which global panning thing you want to change. It
  502. // is one of the GLOBALPAN_ defines in de_codes.h.
  503. LTRESULT (*SetGlobalPanTexture)(uint32 index, char *pFilename);
  504. LTRESULT (*SetGlobalPanInfo)(uint32 index, float xOffset, float zOffset, float xScale, float zScale);
  505. // Register a surface effect. You should register all your effects in OnEngineInitialized
  506. // (before you start a world).
  507. LTRESULT (*AddSurfaceEffect)(SurfaceEffectDesc *pDesc);
  508. // Turn the input state on or off. This is for times when the client
  509. // is interacting with menus and you don't want their mouse movement or
  510. // keystrokes to get sent to the server. This defaults to ON.
  511. void (*SetInputState)(LTBOOL bOn);
  512. // Clears all the keyboard, command, and axis offset input.
  513. LTRESULT (*ClearInput)();
  514. // Returns a list of DeviceBindings for a given device. You must call FreeDeviceBindings()
  515. // to free the list.
  516. DeviceBinding* (*GetDeviceBindings)(uint32 nDevice);
  517. void (*FreeDeviceBindings)(DeviceBinding* pBindings);
  518. // Track Input Devices. Between calls to StartDeviceTrack() and EndDeviceTrack() no command
  519. // states will be set through the normal input. Pass in the devices to track (DEVICETYPE_
  520. // defines) and a buffer size for all input devices. The buffer size is the number of events
  521. // that could occur between calls to TrackDevice(), not to exceed MAX_INPUT_BUFFER_SIZE.
  522. // Supply TrackDevice() with an array of DeviceInput structures, and the number of structures
  523. // in the array. When TrackDevice() returns, the pnInOut variable will contain the number of
  524. // events that have occurred (the number of filled-in DeviceInput structures). If there were
  525. // more events that occurred than the original buffer size allowed for, TrackDevice will return
  526. // LT_INPUTBUFFEROVERFLOW.
  527. LTRESULT (*StartDeviceTrack)(uint32 nDevices, uint32 nBufferSize);
  528. LTRESULT (*TrackDevice)(DeviceInput* pInputArray, uint32* pnInOut);
  529. LTRESULT (*EndDeviceTrack)();
  530. // Retrieve a list of device objects (like axes, buttons, etc.) for one or more devices.
  531. // Pass GetDeviceObjects a combination of DEVICETYPE_ flags and it will return a DeviceObject
  532. // (defined in ltbasedefs.h) list.
  533. // You must free the list with FreeDeviceObjects().
  534. DeviceObject* (*GetDeviceObjects)(uint32 nDeviceFlags);
  535. void (*FreeDeviceObjects)(DeviceObject* pList);
  536. // Get the name of the first input device of the given type.
  537. // Returns either LT_OK or LT_NOTFOUND.
  538. LTRESULT (*GetDeviceName)(uint32 nDeviceType, char* pStrBuffer, uint32 nBufferSize);
  539. // Find out if the specified device is enabled yet.
  540. // Fills in the LTBOOL pointer and always returns LT_OK.
  541. LTRESULT (*IsDeviceEnabled)(char* strDeviceName, LTBOOL* pIsEnabled);
  542. // Attempt to enable specified device.
  543. // Returns LT_OK or LT_ERROR.
  544. LTRESULT (*EnableDevice)(char* strDeviceName);
  545. // These access the GAME timer (which resides on the server).
  546. // Since this comes from the server, it will be intermittent, so only
  547. // use it for things that must be synced with server. This timer will
  548. // not update when there isn't a connection to the server.
  549. float (*GetGameTime)();
  550. float (*GetGameFrameTime)();
  551. // Used to output a TRACE message to the Debug Output window. Newlines must be explicitly used.
  552. void (*DebugOut)( char *pMsg, ... );
  553. // Get the sky definition.
  554. LTRESULT (*GetSkyDef)(SkyDef *pDef);
  555. LTBOOL (*IsCommandOn)(int commandNum);
  556. // Same as typing a string into the console.
  557. void (*RunConsoleString)(char *pString);
  558. // Get your client object (NULL if you don't currently have one).
  559. HLOCALOBJ (*GetClientObject)();
  560. // You can set a global light scale that's applied to all rendering.
  561. // Colors are RGB 0-1 (values are clamped for you).
  562. void (*GetGlobalLightScale)(LTVector *pScale);
  563. void (*SetGlobalLightScale)(LTVector *pScale);
  564. void (*OffsetGlobalLightScale)(LTVector *pOffset);
  565. // Get/set global light direction.
  566. virtual LTRESULT GetGlobalLightDir(LTVector &dir)=0;
  567. virtual LTRESULT SetGlobalLightDir(LTVector dir)=0;
  568. // Get/set global light color
  569. virtual LTRESULT GetGlobalLightColor(LTVector &color)=0;
  570. virtual LTRESULT SetGlobalLightColor(LTVector color)=0;
  571. // Get/set ambient light (0-1, affects R, G, and B).
  572. virtual LTRESULT GetAmbientLight(float &light)=0;
  573. virtual LTRESULT SetAmbientLight(float light)=0;
  574. // Obsolete, use Parse2.
  575. int (*Parse)(char *pCommand, char **pNewCommandPos, char *argBuffer, char **argPointers, int *nArgs);
  576. // Video functions. These functions use Smacker movies.
  577. // OBSOLETE: USE LVideoMgr.
  578. virtual LTRESULT StartVideo(char *pFilename, uint32 flags)=0;
  579. virtual LTRESULT StopVideo()=0;
  580. virtual LTRESULT UpdateVideo()=0;
  581. virtual LTRESULT IsVideoPlaying()=0;
  582. // Messaging.
  583. virtual HMESSAGEWRITE StartMessage(uint8 messageID)=0;
  584. virtual LTRESULT EndMessage(HMESSAGEWRITE hMessage)=0; // Just calls EndMessage2 with MESSAGE_GUARANTEED.
  585. virtual LTRESULT EndMessage2(HMESSAGEWRITE hMessage, uint32 flags)=0;
  586. // NEW message functions. These functions don't free the message so you need to
  587. // call LMessage::Release after sending.
  588. virtual LTRESULT SendToServer(ILTMessage &msg, uint8 msgID, uint32 flags)=0;
  589. // Management of client-side objects.
  590. HLOCALOBJ (*CreateObject)(ObjectCreateStruct *pStruct);
  591. // Obsolete : Use RemoveObject
  592. LTRESULT DeleteObject(HLOCALOBJ hObj) { return RemoveObject(hObj); };
  593. // OBSOLETE: use CommonLT::GetAttachments.
  594. virtual LTRESULT GetAttachments(HLOCALOBJ hObj, HLOCALOBJ *inList, uint32 inListSize,
  595. uint32 *outListSize, uint32 *outNumAttachments)=0;
  596. // Updates the position/rotation of the attachments on the object. Attachments are
  597. // always automatically updated when the object is rendered.
  598. virtual LTRESULT ProcessAttachments(HOBJECT hObj)=0;
  599. // Change position and rotation. It's more efficient to set them
  600. // at the same time...
  601. // By default, the engine ignores really small movement values, but if bForce
  602. // is TRUE, then it will force the move no matter how small.
  603. void (*GetObjectPos)(HLOCALOBJ hObj, LTVector *pPos);
  604. virtual LTRESULT SetObjectPos(HLOCALOBJ hObj, LTVector *pPos, LTBOOL bForce=LTFALSE)=0;
  605. void (*GetObjectRotation)(HLOCALOBJ hObj, LTRotation *pRotation);
  606. void (*SetObjectRotation)(HLOCALOBJ hObj, LTRotation *pRotation);
  607. void (*SetObjectPosAndRotation)(HLOCALOBJ hObj, LTVector *pPos, LTRotation *pRotation);
  608. // Get/Set scale.
  609. LTRESULT (*GetObjectScale)(HLOCALOBJ hObj, LTVector *pScale);
  610. LTRESULT (*SetObjectScale)(HLOCALOBJ hObj, LTVector *pScale);
  611. // RGB 0-1.
  612. void (*GetObjectColor)(HLOCALOBJ hObject, float *r, float *g, float *b, float *a);
  613. void (*SetObjectColor)(HLOCALOBJ hObject, float r, float g, float b, float a);
  614. // OBSOLETE: Use CommonDE::GetObjectFlags/SetObjectFlags.
  615. virtual uint32 GetObjectFlags(HOBJECT hObj)=0;
  616. virtual void SetObjectFlags(HOBJECT hObj, uint32 flags)=0;
  617. // Get/Set object user flags. Can't set user flags on an object
  618. // created on the server.
  619. LTRESULT (*GetObjectUserFlags)(HLOCALOBJ hObj, uint32 *pFlags);
  620. LTRESULT (*SetObjectUserFlags)(HLOCALOBJ hObj, uint32 flags);
  621. // Get/set the client flags (defined above).
  622. uint32 (*GetObjectClientFlags)(HLOCALOBJ hObj);
  623. void (*SetObjectClientFlags)(HLOCALOBJ hObj, uint32 flags);
  624. // User data for the object..
  625. void* (*GetObjectUserData)(HLOCALOBJ hObj);
  626. void (*SetObjectUserData)(HLOCALOBJ hObj, void *pData);
  627. // Camera functions.
  628. // Gets the 3D coordinates of a screen coordinate given a camera. The 3D
  629. // coordinate is one unit out along the forward vector. Returns LT_OUTSIDE
  630. // if the screen coordinates aren't inside the camera's rectangle.
  631. LTRESULT (*Get3DCameraPt)(HLOCALOBJ hCamera, int sx, int sy, LTVector *pOut);
  632. // Get/Set a camera's FOV. It defaults to (PI/2, PI/2).
  633. // It will clamp your values between (PI/100, 99*PI/100)
  634. void (*GetCameraFOV)(HLOCALOBJ hObj, float *pX, float *pY);
  635. void (*SetCameraFOV)(HLOCALOBJ hObj, float fovX, float fovY);
  636. void (*GetCameraRect)(HLOCALOBJ hObj, LTBOOL *bFullscreen,
  637. int *left, int *top, int *right, int *bottom);
  638. // Set the camera's rectangle on the screen.
  639. // If bFullscreen is LTTRUE, then it ignores the rect and draws the
  640. // camera fullscreen. If the rectangle extends over the screen
  641. // boundaries, then it is clipped..
  642. void (*SetCameraRect)(HLOCALOBJ hObj, LTBOOL bFullscreen,
  643. int left, int top, int right, int bottom);
  644. // Get/Set the camera light add. RGB 0-1. Light add is applied AFTER
  645. // scaling, so if light is fully bright and scaling is zero, you'll just
  646. // see whiteness. When the light add is nonzero, it draws a poly over
  647. // the screen so don't use it all the time!
  648. // These return LTFALSE if the object is not a camera.
  649. LTBOOL (*GetCameraLightAdd)(HLOCALOBJ hCamera, LTVector *pAdd);
  650. LTBOOL (*SetCameraLightAdd)(HLOCALOBJ hCamera, LTVector *pAdd);
  651. // Particle system manipulation.
  652. // gravityAccel default is -500
  653. // flags default is 0
  654. // particleRadius default is 300
  655. // color scale defauls to 1.0
  656. // Particle colors are 0-255.
  657. // All particle positions are RELATIVE to the particle system's
  658. // position and rotation. In many cases, you can have your code be very simple
  659. // and fast if you just move and rotate the particle system and not the particles.
  660. // Change the system's parameters.
  661. LTRESULT (*SetupParticleSystem)(HLOCALOBJ hObj, char *pTextureName, float gravityAccel, uint32 flags, float particleRadius);
  662. // The software version uses a single color for all the particles in each
  663. // system specified here (default 1). RGB (0-1).
  664. LTRESULT (*SetSoftwarePSColor)(HLOCALOBJ hObj, float r, float g, float b);
  665. virtual LTParticle* AddParticle(HLOCALOBJ hObj, LTVector *pPos, LTVector *pVelocity, LTVector *pColor, float lifeTime)=0;
  666. void (*AddParticles)(HLOCALOBJ hObj, uint32 nParticles,
  667. LTVector *pMinOffset, LTVector *pMaxOffset,
  668. LTVector *pMinVelocity, LTVector *pMaxVelocity,
  669. LTVector *pMinColor, LTVector *pMaxColor,
  670. float minLifetime, float maxLifetime);
  671. LTBOOL (*GetParticles)(HLOCALOBJ hObj, LTParticle **pHead, LTParticle **pTail);
  672. // Get/Set particle positions. hSystem is NOT checked to be valid here
  673. // for speed so make sure it's valid!
  674. void (*GetParticlePos)(HLOCALOBJ hSystem, LTParticle *pParticle, LTVector *pPos);
  675. void (*SetParticlePos)(HLOCALOBJ hSystem, LTParticle *pParticle, LTVector *pPos);
  676. // Get particle lifetimes. hSystem is NOT checked to be valid here
  677. // for speed so make sure it's valid!
  678. LTRESULT (*GetParticleLifetime)(HLOCALOBJ hSystem, LTParticle *pParticle, LTFLOAT & fLifetime);
  679. LTRESULT (*GetParticleTotalLifetime)(HLOCALOBJ hSystem, LTParticle *pParticle, LTFLOAT & fTotalLifetime);
  680. // Remove a particle.
  681. void (*RemoveParticle)(HLOCALOBJ hSystem, LTParticle *pParticle);
  682. // This is an optimization you can make to help the engine minimize its boundaries on
  683. // a particle system. If you create particles in various places and they go away, you
  684. // can use this every so often to recalculate where the particles are.
  685. LTRESULT (*OptimizeParticles)(HLOCALOBJ hSystem);
  686. // Line system manipulation.
  687. // As with particle systems, the lines are centered around the object's origin.
  688. // Don't just place the object at the origin and put lines way off to the side,
  689. // it's more efficient to keep the lines as close to the center as possible.
  690. // Set hPrev to NULL to start, then pass in the return value, etc..
  691. // Returns LTNULL for last line.
  692. // ** If you call RemoveLine on the current HLTLINE, DO NOT
  693. // ** pass that into GetNextLine - call GetNextLine first
  694. // ** while the HLTLINE is still valid!
  695. HLTLINE (*GetNextLine)(HLOCALOBJ hObj, HLTLINE hPrev);
  696. void (*GetLineInfo)(HLTLINE hLine, LTLine *pLine);
  697. void (*SetLineInfo)(HLTLINE hLine, LTLine *pLine);
  698. // Adds a line to the end of the line system's list.
  699. HLTLINE (*AddLine)(HLOCALOBJ hObj, LTLine *pLine);
  700. void (*RemoveLine)(HLOCALOBJ hObj, HLTLINE hLine);
  701. // Poly grid manipulation.
  702. // A poly grid is basically a heightmapped grid of pixels that are drawn
  703. // as polygons. Each pixel can have a value from -127 to 127. The pixel's value
  704. // defines its height and is a lookup into the color table for the vertex color.
  705. // You can scale and rotate the poly grid using SetObjectScale and SetObjectRotation.
  706. // bHalfTriangles will cause it to look VERY triangulated, but draw way faster.
  707. LTBOOL (*SetupPolyGrid)(HLOCALOBJ hObj, uint32 width, uint32 height, LTBOOL bHalfTrianges);
  708. // Set the texture. The texture MUST be a sprite file. It CANNOT be a .dtx file!
  709. LTRESULT (*SetPolyGridTexture)(HLOCALOBJ hObj, char *pFilename);
  710. // Set the environment map for the PolyGrid. This MUST be a DTX file.
  711. // Specify NULL if you want to disable the environment map. Returns
  712. // LT_NOTFOUND if it can't find the specified map.
  713. LTRESULT (*SetPolyGridEnvMap)(HLOCALOBJ hObj, char *pFilename);
  714. // Get/Set the texture pan and scale for a PolyGrid.
  715. // Defaults are 0.0 for xPan and yPan, and 1.0 for xScale and yScale.
  716. LTRESULT (*GetPolyGridTextureInfo)(HLOCALOBJ hObj, float *xPan, float *yPan, float *xScale, float *yScale);
  717. LTRESULT (*SetPolyGridTextureInfo)(HLOCALOBJ hObj, float xPan, float yPan, float xScale, float yScale);
  718. // You can set it to be transparent or not. It defaults to not being transparent.
  719. LTRESULT (*GetPolyGridInfo)(HLOCALOBJ hObj, char **pBytes, uint32 *pWidth, uint32 *pHeight, PGColor **pColorTable);
  720. // Set pMin and pMax to the dimensions of the box you want the polygrid to fit in.
  721. // pPos and pScale will be filled in with the recommended position and scale.
  722. LTRESULT (*FitPolyGrid)(HLOCALOBJ hObj, LTVector *pMin, LTVector *pMax, LTVector *pPos, LTVector *pScale);
  723. // Light manipulation.
  724. // Get/Set a light's color (RGB, 0.0f to 1.0f).
  725. // When you create a light, its color defaults to (0,0,0).
  726. void (*GetLightColor)(HLOCALOBJ hObj, float *r, float *g, float *b);
  727. void (*SetLightColor)(HLOCALOBJ hObj, float r, float g, float b);
  728. // Get/Set a light's radius.
  729. // When you create a light, its radius defaults to 100.
  730. float (*GetLightRadius)(HLOCALOBJ hObj);
  731. void (*SetLightRadius)(HLOCALOBJ hObj, float radius);
  732. // Sprite manipulation.
  733. // This clips the sprite on the poly.
  734. // Returns LT_OK or LT_ERROR if not a sprite.
  735. // Pass in INVALID_HPOLY to un-clip the sprite.
  736. LTRESULT (*ClipSprite)(HLOCALOBJ hObj, HPOLY hPoly);
  737. // Get the sprite control interface for a sprite. Returns LT_INVALIDPARAMS
  738. // if the object is not a sprite.
  739. virtual LTRESULT GetSpriteControl(HLOCALOBJ hObj, ILTSpriteControl* &pControl)=0;
  740. // Canvas manipulation.
  741. virtual LTRESULT GetCanvasFn(HOBJECT hCanvas, CanvasDrawFn &fn, void* &pUserData)=0;
  742. virtual LTRESULT SetCanvasFn(HOBJECT hCanvas, CanvasDrawFn fn, void* pUserData)=0;
  743. virtual LTRESULT GetCanvasRadius(HOBJECT hCanvas, float &radius)=0;
  744. virtual LTRESULT SetCanvasRadius(HOBJECT hCanvas, float radius)=0;
  745. // Client-side models..
  746. // Use this to control the nodes on the model.
  747. // NOTE: your function should return as FAST as possible - it will be called a lot.
  748. // NodeControlFn will be called for each node on the model allowing you to
  749. // translate and rotate it.
  750. // Pass NULL for the NodeControlFn to disable it.
  751. // Note: this slows down rendering because the engine can't assume a bounding radius.
  752. // If you know your movement won't move anything outside of its bounding radius, you
  753. // can set CF_INSIDERADIUS to avoid a speed hit.
  754. virtual LTRESULT ModelNodeControl(HOBJECT hObj, NodeControlFn fn, void *pUserData)=0;
  755. // Iterate through the model's nodes. Returns LT_FINISHED when there are no more.
  756. // hCurNode = INVALID_MODEL_NODE;
  757. // while(interface->GetNextModelNode(hModel, hCurNode, &hCurNode) == LT_OK)
  758. // { ... }
  759. LTRESULT (*GetNextModelNode)(HLOCALOBJ hObject, HMODELNODE hNode, HMODELNODE *pNext);
  760. // Get a model node's name.
  761. LTRESULT (*GetModelNodeName)(HLOCALOBJ hObject, HMODELNODE hNode, char *pName, uint32 maxLen);
  762. // OBSOLETE: Use ModelLT functions.
  763. // Returns the animation the model is currently on. (uint32)-1 if none.
  764. virtual uint32 GetModelAnimation(HLOCALOBJ hObj)=0;
  765. virtual void SetModelAnimation(HLOCALOBJ hObj, uint32 iAnim)=0;
  766. // Starts the current animation over.
  767. virtual LTRESULT ResetModelAnimation(HLOCALOBJ hObj)=0;
  768. // Tells what the playback state of the model is (a combination of the
  769. // MS_ bits defined in basedefs_de.h).
  770. virtual uint32 GetModelPlaybackState(HLOCALOBJ hObj)=0;
  771. // Get/Set the looping state of the model. The default state is TRUE.
  772. virtual LTBOOL GetModelLooping(HLOCALOBJ hObj)=0;
  773. virtual void SetModelLooping(HLOCALOBJ hObj, LTBOOL bLoop)=0;
  774. // Get/Set the playing state of the model. The default state is FALSE.
  775. virtual LTBOOL GetModelPlaying(HLOCALOBJ hObj)=0;
  776. virtual void SetModelPlaying(HLOCALOBJ hObj, LTBOOL bPlaying)=0;
  777. // (Geometry) surface functions.
  778. LTBOOL (*GetSurfaceBounds)(SurfaceData *pSurface, LTVector *pMin, LTVector *pMax);
  779. // Hide/Unhide a poly.
  780. LTRESULT (*SetPolyHideStatus)(HPOLY hPoly, LTBOOL bHide);
  781. // Get the texture flags from a poly. Returns LT_OK
  782. // or LT_ERROR if no world is loaded or hPoly is invalid.
  783. LTRESULT (*GetPolyTextureFlags)(HPOLY hPoly, uint32 *pFlags);
  784. // Render hooks.
  785. // When this is set, the renderer will call your hook function before drawing each
  786. // model. Either keep the function very fast or set it to NULL so you don't slow
  787. // the renderer down.
  788. LTRESULT (*SetModelHook)(ModelHookFn fn, void *pUser);
  789. // Engine hooks.
  790. // This is here so we can avoid adding API functions if necessary and for
  791. // some system-dependent or misc. stuff. Pass in a string describing what
  792. // you want and it fills in pData.
  793. // Returns LT_OK if it understands the string or an error otherwise.
  794. // Strings:
  795. // HWND: Returns main window handle.
  796. LTRESULT (*GetEngineHook)(char *pName, void **pData);
  797. // Network startup/join/host functions.
  798. // Call this function before calling any other
  799. // network functions. pDriver can be NULL to use the default net driver.
  800. // No flags are currently supported.
  801. LTRESULT (*InitNetworking)(char *pDriver, uint32 dwFlags);
  802. // Gets a list of net services (tcp/ip, modem, etc).
  803. LTRESULT (*GetServiceList)(NetService* &pListHead);
  804. // Call this function when you are finished using the list returned by
  805. // GetServiceList().
  806. LTRESULT (*FreeServiceList)(NetService *pListHead);
  807. // Selects the given service as the one to use.
  808. LTRESULT (*SelectService)(HNETSERVICE hNetService);
  809. // Gets a list (and count) of enumerated sessions.
  810. // See driver flags for a description of pInfo.
  811. LTRESULT (*GetSessionList)(NetSession* &pListHead, char *pInfo);
  812. // Call this function when you are finished using the list returned by
  813. // GetSessionList().
  814. LTRESULT (*FreeSessionList)(NetSession *pListHead);
  815. LTRESULT (*AddInternetDriver)();
  816. LTRESULT (*RemoveInternetDriver)();
  817. // Alternate mode of getting session lists. These only work for services with
  818. // the NETSERVICE_TCPIP flag. These functions return immediately so you can update
  819. // a UI in the background without having to 'freeze' the UI while it queries hosts.
  820. // Start querying. pInfo contains the address list formatted just like GetSessionLists.
  821. virtual LTRESULT StartQuery(char *pInfo)=0;
  822. // Update the query. Call this as often as possible.
  823. virtual LTRESULT UpdateQuery()=0;
  824. // Get the current list of results from the query. Each time you call this,
  825. // a new session list is allocated and you need to free it with FreeSessionList.
  826. virtual LTRESULT GetQueryResults(NetSession* &pListHead)=0;
  827. // End the current query.
  828. virtual LTRESULT EndQuery()=0;
  829. // Determines if we werw lobby launched.
  830. LTRESULT (*IsLobbyLaunched)(char* sDriver);
  831. // Gets the lobby launch info if available.
  832. LTRESULT (*GetLobbyLaunchInfo)(char* sDriver, void** ppLobbyLaunchData);
  833. // Gets the tcp/ip address of the main driver if available.
  834. LTRESULT (*GetTcpIpAddress)(char* sAddress, uint32 dwBufferSize);
  835. protected:
  836. ILTVideoMgr *m_pVideoMgr;
  837. ILTTexMod *m_pTexMod;
  838. ILTCursor *m_pCursorLT;
  839. ILTDirectMusicMgr *m_pDirectMusicMgr;
  840. };
  841. #endif // __ILTCLIENT_H__