// absolutely ugly, need a better way const char* CLuaClassDefs::GetEntityClass ( CClientEntity* pEntity ) { assert ( pEntity ); switch ( pEntity->GetType () ) { case CCLIENTCAMERA: return NULL; case CCLIENTPLAYER: return "Player"; case CCLIENTVEHICLE: return "Vehicle"; case CCLIENTRADARMARKER: return "Blip"; case CCLIENTOBJECT: return "Object"; case CCLIENTPICKUP: return "Pickup"; case CCLIENTRADARAREA: return "RadarArea"; case CCLIENTMARKER: return "Marker"; case CCLIENTTEAM: return "Team"; case CCLIENTPED: return "Ped"; case CCLIENTPROJECTILE: return "Projectile"; case CCLIENTGUI: { CClientGUIElement* pGUIElement = reinterpret_cast < CClientGUIElement* > ( pEntity ); if ( pGUIElement ) { switch ( pGUIElement->GetCGUIType () ) { case CGUI_BUTTON: return "GuiButton"; case CGUI_CHECKBOX: return "GuiCheckBox"; case CGUI_EDIT: return "GuiEdit"; case CGUI_GRIDLIST: return "GuiGridList"; case CGUI_LABEL: return "GuiLabel"; case CGUI_MEMO: return "GuiMemo"; case CGUI_PROGRESSBAR: return "GuiProgressBar"; case CGUI_RADIOBUTTON: return "GuiButton"; case CGUI_STATICIMAGE: return "GuiImage"; case CGUI_TAB: return "GuiTab"; case CGUI_TABPANEL: return "GuiTabPanel"; case CGUI_WINDOW: return "GuiWindow"; case CGUI_SCROLLPANE: return "GuiScrollPane"; case CGUI_SCROLLBAR: return "GuiScrollBar"; case CGUI_COMBOBOX: return "GuiComboBox"; } return "GuiElement"; } break; } case CCLIENTCOLSHAPE: return "ColShape"; case SCRIPTFILE: return "File"; case CCLIENTDFF: return NULL; case CCLIENTCOL: return NULL; case CCLIENTTXD: return NULL; case CCLIENTSOUND: return "Sound"; case CCLIENTWATER: return "Water"; case CCLIENTDXFONT: return NULL; case CCLIENTGUIFONT: return NULL; case CCLIENTTEXTURE: return NULL; case CCLIENTSHADER: return NULL; case CCLIENTWEAPON: return "Weapon"; case CCLIENTEFFECT: return "Effect"; } return "Element"; }
int CLuaFunctionDefs::GUIGetBrowser ( lua_State* luaVM ) // Or rather guiGetBrowserBrowser? { // webbrowser guiGetBrowser ( gui-webbrowser browser ) CClientGUIElement* pGUIElement; CScriptArgReader argStream ( luaVM ); argStream.ReadUserData < CGUIWebBrowser > ( pGUIElement ); if ( !argStream.HasErrors () ) { if ( IS_GUI ( pGUIElement ) && pGUIElement->GetCGUIType () == CGUI_WEBBROWSER ) { CClientGUIWebBrowser* pGUIBrowser = static_cast < CClientGUIWebBrowser* > ( pGUIElement ); lua_pushelement ( luaVM, pGUIBrowser->GetBrowser () ); return 1; } } else m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () ); lua_pushboolean ( luaVM, false ); return 1; }
// absolutely ugly, need a better way const char* CLuaClassDefs::GetEntityClass ( CClientEntity* pEntity ) { assert ( pEntity ); switch ( pEntity->GetType () ) { case CCLIENTCAMERA: return "Camera"; case CCLIENTPLAYER: return "Player"; case CCLIENTVEHICLE: return "Vehicle"; case CCLIENTRADARMARKER: return "Blip"; case CCLIENTOBJECT: return "Object"; case CCLIENTPICKUP: return "Pickup"; case CCLIENTRADARAREA: return "RadarArea"; case CCLIENTMARKER: return "Marker"; case CCLIENTTEAM: return "Team"; case CCLIENTPED: return "Ped"; case CCLIENTPROJECTILE: return "Projectile"; case CCLIENTGUI: { CClientGUIElement* pGUIElement = reinterpret_cast < CClientGUIElement* > ( pEntity ); if ( pGUIElement ) { switch ( pGUIElement->GetCGUIType () ) { case CGUI_BUTTON: return "GuiButton"; case CGUI_CHECKBOX: return "GuiCheckBox"; case CGUI_EDIT: return "GuiEdit"; case CGUI_GRIDLIST: return "GuiGridList"; case CGUI_LABEL: return "GuiLabel"; case CGUI_MEMO: return "GuiMemo"; case CGUI_PROGRESSBAR: return "GuiProgressBar"; case CGUI_RADIOBUTTON: return "GuiRadioButton"; case CGUI_STATICIMAGE: return "GuiStaticImage"; case CGUI_TAB: return "GuiTab"; case CGUI_TABPANEL: return "GuiTabPanel"; case CGUI_WINDOW: return "GuiWindow"; case CGUI_SCROLLPANE: return "GuiScrollPane"; case CGUI_SCROLLBAR: return "GuiScrollBar"; case CGUI_COMBOBOX: return "GuiComboBox"; case CGUI_WEBBROWSER: return "GuiBrowser"; } return "GuiElement"; } break; } case CCLIENTCOLSHAPE: return "ColShape"; case SCRIPTFILE: return "File"; case CCLIENTDFF: return "EngineDFF"; case CCLIENTCOL: return "EngineCOL"; case CCLIENTTXD: return "EngineTXD"; case CCLIENTSOUND: return static_cast<CClientSound*>( pEntity )->IsSound3D() ? "Sound3D" : "Sound"; case CCLIENTWATER: return "Water"; case CCLIENTDXFONT: return "DxFont"; case CCLIENTGUIFONT: return "GuiFont"; case CCLIENTTEXTURE: return "DxTexture"; case CCLIENTSHADER: return "DxShader"; case CCLIENTWEAPON: return "Weapon"; case CCLIENTEFFECT: return "Effect"; case CCLIENTPOINTLIGHTS: return "Light"; case CCLIENTSCREENSOURCE: return "DxScreenSource"; case CCLIENTRENDERTARGET: return "DxRenderTarget"; case CCLIENTBROWSER: return "Browser"; } return "Element"; }