From 06203d8767e7da55deb4947c7660ff0136a31f29 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 30 Jun 2018 21:20:51 -0600 Subject: Removed some dead code Removed a lot of commented out old code --- src/client/lua_api/gui/iguibutton.cpp | 46 --------------------- src/client/lua_api/gui/iguielement.cpp | 71 --------------------------------- src/client/lua_api/gui/iguiimage.cpp | 29 -------------- src/client/lua_api/gui/iguilabel.cpp | 6 --- src/client/lua_api/gui/iguiwindow.cpp | 12 ------ src/client/lua_api/gui/simple.cpp | 10 ++--- src/client/lua_api/phys/bphysbuffer.cpp | 6 --- src/client/lua_api/phys/bphysmodel.cpp | 22 ---------- src/client/lua_api/phys/cbphysbox.cpp | 13 ------ src/client/lua_api/scene/icamera.cpp | 35 ---------------- src/client/lua_api/scene/igeneric.cpp | 11 ----- src/client/lua_api/scene/ilight.cpp | 10 ----- src/client/lua_api/scene/imesh.cpp | 27 ------------- 13 files changed, 5 insertions(+), 293 deletions(-) (limited to 'src/client/lua_api') diff --git a/src/client/lua_api/gui/iguibutton.cpp b/src/client/lua_api/gui/iguibutton.cpp index 25a30ed..2d04fd1 100644 --- a/src/client/lua_api/gui/iguibutton.cpp +++ b/src/client/lua_api/gui/iguibutton.cpp @@ -24,52 +24,6 @@ using namespace gui; extern IrrlichtDevice* device; char lhashkey[20]; -//static LIGUIElement* checkiguibutton(lua_State* L, int index){ - //void* ud = luaL_checkudata(L,index,"gui.iguibutton"); - //luaL_argcheck(L,ud != NULL, index, "'gui.iguibutton' expected"); - //return (LIGUIElement*) ud; -//} - -//static LIGUIElement* checkiguibutton(lua_State* L){ - //return checkiguibutton(L,1); -//} - -//The callback even for all gui buttons -//static bool iguibuttonevent(irr::SEvent e){ - //IGUIElement* caller = (IGUIElement*)e.GUIEvent.Caller; - //printf("Some gui something somewhere was pressed\n"); - //if(iguielements.find(caller) != iguielements.end()){ - //printf("I know what reference is linked to that button: %d!\n",iguielements[caller]); - //int ref = iguielements[caller]; - //EGUI_EVENT_TYPE etype = e.GUIEvent.EventType; - //if(etype == EGET_BUTTON_CLICKED){ - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //printf("getting raw, the thing on the top of stack is a %s\n",luaL_typename(tL,-1)); - //LIGUIElement* tbut = checkiguibutton(tL,-1); - //int hashmapresponse; - //char* hashkey = (char*)"onpress"; - //int terror = hashmap_get(tbut->funcmap,hashkey,(void**)&hashmapresponse); - //if(terror == MAP_OK){ - //lua_rawgeti(tL,LUA_REGISTRYINDEX,hashmapresponse); - //lua_call(tL,0,0); - //}else{ - //printf("Tried to call onpress on something that dosen't have onpress\n"); - //} - //}else if(etype == EGET_ELEMENT_HOVERED){ - //printf("Trying to call onhovered!\n"); - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //LIGUIElement* tbut = (LIGUIElement*)lua_touserdata(tL,-1); - //int hashmapresponse; - //int terror = hashmap_get(tbut->funcmap,(char*)"onhovered",(void**)&hashmapresponse); - //if(terror == MAP_OK){ - //lua_rawgeti(tL,LUA_REGISTRYINDEX,hashmapresponse); - //lua_call(tL,0,0); - //} - //} - //} - //return false; -//} - //gui.newbutton({{sx,sy},{ex,ey}},"text"[,parent]) static int newiguibutton(lua_State* L){ printf("Createing gui button!\n"); diff --git a/src/client/lua_api/gui/iguielement.cpp b/src/client/lua_api/gui/iguielement.cpp index bdc13df..0fb25f1 100644 --- a/src/client/lua_api/gui/iguielement.cpp +++ b/src/client/lua_api/gui/iguielement.cpp @@ -15,17 +15,6 @@ using namespace irr; using namespace core; using namespace gui; -//static LIGUIElement* toiguielement(lua_State* L,int index){ - //LIGUIElement* ret = (LIGUIElement*)lua_touserdata(L,index); - //if(ret == NULL) - //luaL_typerror(L,index,"LIGUIButton"); - //return ret; -//} - -//static LIGUIElement* toiguielement(lua_State* L){ - //return toiguielement(L,1); -//} - //move({element},{x,y}) -> nil int moveiguielement(lua_State* L){ //printf("Got call to move element\n"); @@ -58,15 +47,6 @@ int getiguiclippingrect(lua_State* L){ ); return 1; } -/* -int moveiguielement(lua_State* L){ - LIGUIElement* ele = toiguielement(L,1); - int x = luaL_optint(L,2,0); - int y = luaL_optint(L,3,0); - ele->e->move(position2d(x,y)); - return 0; -} -*/ //setText({guielement},"text") :: nil int setiguitext(lua_State* L){ @@ -122,60 +102,9 @@ public: //{guielement} //popelementcallback(lua_State* L, gui::EGUI_EVENT_TYPE, char*) void setelementcallback(lua_State* L,gui::EGUI_EVENT_TYPE et, const char* funcname){ - //lua_getfield(L,-1,"guielement");//{guielement} - //IGUIElement* el = (IGUIElement*)lua_touserdata(L,-1);//{guielement},ud_element - //lua_pop(L,1);//{guielement} registerguielement(L); - //int ref = luaL_ref(L,LUA_REGISTRYINDEX);// - //guicallback* gc = new guicallback(L,ref,funcname);//TODO:Clean this up somehow - //popregisterguicallback(el,et, gc); - //lua_rawgeti(L,LUA_REGISTRYINDEX,ref);//{guielement} } -//int guigethandeler(lua_State* L){ - //printf("Called the get index handeler!\n"); - //LIGUIElement* button = toiguielement(L); - //if(!lua_isstring(L,2)){ - //luaL_error(L,"index of iguibutton must be of type 'string'"); - //} - //const char* lstr = lua_tostring(L,2); - //char* hashkey = (char*)malloc(sizeof(char)*strlen(lstr)); - //strcpy(hashkey,lstr); - //int ref; - //if(hashmap_get(button->funcmap,hashkey,(void**)&ref) == MAP_OK){ - ////We found the value in our hashmap! - //lua_rawgeti(L,LUA_REGISTRYINDEX,ref); - //return 1; - //}else{ - ////Could not find in hashmap, check parrent - //lua_getglobal(L,button->type); - //printf("Button's type is %s\n",button->type); - //lua_getfield(L,-1,lstr); - //return 1; - //} -//} - -//int guisethandeler(lua_State* L){ - //printf("Called the set index handeler\n"); - //LIGUIElement* button = toiguielement(L); - //if(!lua_isstring(L,2)){ - //luaL_error(L,"index of iguibutton must be of type 'string'"); - //} - //const char* lstr = lua_tostring(L,2); - //char* hashkey = (char*)malloc(sizeof(char)*strlen(lstr)); - //strcpy(hashkey,lstr); - //int oldref; - //if(hashmap_get(button->funcmap,hashkey,(void**)&oldref) == MAP_OK){ - //luaL_unref(L,LUA_REGISTRYINDEX,oldref); - //hashmap_remove(button->funcmap,hashkey); - //} - //int ref = luaL_ref(L,LUA_REGISTRYINDEX); - //if(hashmap_put(button->funcmap,hashkey,(void*)ref) != MAP_OK){ - //luaL_error(L,"Error while setting the hashkey on iguibutton"); - //} - //return 0; -//} - //ud_iguielement int guigetid(lua_State* L){ IGUIElement* el = (IGUIElement*)lua_touserdata(L,-1); diff --git a/src/client/lua_api/gui/iguiimage.cpp b/src/client/lua_api/gui/iguiimage.cpp index 0428344..13a52b6 100644 --- a/src/client/lua_api/gui/iguiimage.cpp +++ b/src/client/lua_api/gui/iguiimage.cpp @@ -22,35 +22,6 @@ using namespace gui; extern IrrlichtDevice* device; extern IGUIEnvironment* env; -//IrrlichtDevice* guidevice; - - -//static bool iguiimageevent(irr::SEvent e){ - //IGUIElement* caller = (IGUIElement*)e.GUIEvent.Caller; - //int ref = iguielements[caller]; - //EGUI_EVENT_TYPE etype = e.GUIEvent.EventType; - //printf("Detected image event\n"); - //if(etype == EGET_ELEMENT_CLOSED){ - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //printf("getting raw, the thing on the top of stack is a %s\n",luaL_typename(tL,-1)); - //LIGUIElement* tbut = checkiguiwindow(tL,-1); - //int hashmapresponse; - //char* hashkey = (char*)"onclose"; - //int terror = hashmap_get(tbut->funcmap,hashkey,(void**)&hashmapresponse); - //if(terror == MAP_OK){ //Only call if we actually have that function. - //printf("Looks like we have an onclose function, calling!\n"); - //lua_rawgeti(tL,LUA_REGISTRYINDEX,hashmapresponse); //push the function - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); //push the referance to iguielement - //lua_call(tL,1,1); - ////int b = lua_isnoneornil(tL,1); - //int a = lua_toboolean(tL,-1); - //printf("a:%d\n",a); - //return a; - //} - //} - //printf("Oh no! an iguiimage generated an event!"); - //return false; -//} //new({startx,starty},alpha,{itexture}) -> {guielement} static int newiguiimage(lua_State* L){ diff --git a/src/client/lua_api/gui/iguilabel.cpp b/src/client/lua_api/gui/iguilabel.cpp index dce1b15..578bca7 100644 --- a/src/client/lua_api/gui/iguilabel.cpp +++ b/src/client/lua_api/gui/iguilabel.cpp @@ -22,12 +22,6 @@ using namespace gui; extern IrrlichtDevice* device; -//IrrlichtDevice* guidevice; -//static bool iguilabelevent(irr::SEvent e){ - //printf("Oh no! an iguilabel generated an event!"); - //return false; -//} - //gui.newguilabel({{sx,sy},{ex,ey}},"text"[,parent]) :: {guielement} static int newiguilabel(lua_State* L){ printf("Createing label!\n"); diff --git a/src/client/lua_api/gui/iguiwindow.cpp b/src/client/lua_api/gui/iguiwindow.cpp index 30af486..fc85217 100644 --- a/src/client/lua_api/gui/iguiwindow.cpp +++ b/src/client/lua_api/gui/iguiwindow.cpp @@ -20,18 +20,6 @@ extern "C" { using namespace irr; using namespace gui; -//static bool iguiwindowevent(irr::SEvent e){ - //int ref = iguielements[e.GUIEvent.Caller]; - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //lua_getfield(tL,-1,"close"); - - //lua_rawgeti(tL,LUA_REGISTRYINDEX,ref); - //lua_call(tL,1,1); - - //int shouldclose = lua_toboolean(tL,-1); - //return shouldclose == 1; -//} - //new({{sx,sy},{ex,ey}},"title"[,{guielement=parent}]) :: {guielement} static int newiguiwindow(lua_State* L){ IGUIElement* parent = NULL; diff --git a/src/client/lua_api/gui/simple.cpp b/src/client/lua_api/gui/simple.cpp index 8790069..8e8b237 100644 --- a/src/client/lua_api/gui/simple.cpp +++ b/src/client/lua_api/gui/simple.cpp @@ -1,8 +1,8 @@ -#include -extern "C" { - #include - #include - #include +#include +extern "C" { + #include + #include + #include } // {{startx, starty},{endx,endy}} diff --git a/src/client/lua_api/phys/bphysbuffer.cpp b/src/client/lua_api/phys/bphysbuffer.cpp index a8f7302..f1f20c0 100644 --- a/src/client/lua_api/phys/bphysbuffer.cpp +++ b/src/client/lua_api/phys/bphysbuffer.cpp @@ -34,12 +34,6 @@ static LBPhysNode* checkisbphysmodel(lua_State* L, int index){ return (LBPhysNode*) ud; } -/* -static LISceneNode* checkismesh(lua_State* L){ - return checkismesh(L,1); -} -*/ - //iscenecamera.new(Vector position, Vector lookat, parrent) // {} {} 0 1 static int newbphysmodel(lua_State* L){ diff --git a/src/client/lua_api/phys/bphysmodel.cpp b/src/client/lua_api/phys/bphysmodel.cpp index 95458b1..fdd5584 100644 --- a/src/client/lua_api/phys/bphysmodel.cpp +++ b/src/client/lua_api/phys/bphysmodel.cpp @@ -34,12 +34,6 @@ static LBPhysNode* checkisbphysmodel(lua_State* L, int index){ return (LBPhysNode*) ud; } -/* -static LISceneNode* checkismesh(lua_State* L){ - return checkismesh(L,1); -} -*/ - //iscenecamera.new(Vector position, Vector lookat, parrent) // {} {} 0 1 static int newbphysmodel(lua_State* L){ @@ -261,23 +255,8 @@ static int bphysgetpos(lua_State *L){ return 1; } -/*mesh:setmaterial("string",layernum=0)*/ -/* -static int setmaterial(lua_State* L){ - LISceneNode* n = checkismesh(L,1); - u32 layernum = luaL_optint(L,3,0); - const char* matfile = luaL_optstring(L,2,"error.png"); - printf("Setting material on a %s",n->type); - IVideoDriver* driver = device->getVideoDriver(); - n->n->setMaterialTexture( 0, driver->getTexture(matfile) ); - return 0; -} -*/ - static const luaL_reg bphysmodel_f[] = { {"new", newbphysmodel}, -// {"gethandeler", guigethandeler}, -// {"sethandeler", guisethandeler}, {0,0}, }; @@ -285,7 +264,6 @@ static const luaL_reg bphysmodel_m[] = { {"setmaterial", iscenesetmaterial}, {"getpos", bphysgetpos}, {"setpos", bphyssetpos}, -// {"settext", setiguitext}, // {"remove", removeiguielement}, {0, 0}, }; diff --git a/src/client/lua_api/phys/cbphysbox.cpp b/src/client/lua_api/phys/cbphysbox.cpp index 0baf45a..94d199f 100644 --- a/src/client/lua_api/phys/cbphysbox.cpp +++ b/src/client/lua_api/phys/cbphysbox.cpp @@ -26,19 +26,6 @@ extern IrrlichtDevice* device; extern btDiscreteDynamicsWorld* World; extern std::list Objects; -/* -static LBPhysNode* checkisbphysbox(lua_State* L, int index){ - void* ud = luaL_checkudata(L,index,"phys.physbox"); - luaL_argcheck(L,ud != NULL, index, "'phys.physbox' expected"); - return (LBPhysNode*) ud; -} -*/ - -/* -static LISceneNode* checkismesh(lua_State* L){ - return checkismesh(L,1); -} -*/ //phys.newphysbox({vector3 size},{vector3 origin},mass) static int newcbphysbox(lua_State* L){// diff --git a/src/client/lua_api/scene/icamera.cpp b/src/client/lua_api/scene/icamera.cpp index 0554ce1..482bf31 100644 --- a/src/client/lua_api/scene/icamera.cpp +++ b/src/client/lua_api/scene/icamera.cpp @@ -22,29 +22,6 @@ using namespace core; extern IrrlichtDevice* device; -//static LISceneNode* checkiscenecamera(lua_State* L, int index){ - //void* ud = luaL_checkudata(L,index,"scene.iscenecamera"); - //luaL_argcheck(L,ud != NULL, index, "'scene.iscenecamera' expected"); - //return (LISceneNode*) ud; -//} - -/* -static LISceneNode* checkiscenecamera(lua_State* L){ - return checkiscenecamera(L,1); -} -*/ - -//static LISceneNode* checkismayacamera(lua_State* L, int index){ - //void* ud = luaL_checkudata(L,index,"scene.iscenemayacamera"); - //luaL_argcheck(L,ud != NULL, index, "'scene.iscenemayacamera' expected"); - //return (LISceneNode*) ud; -//} -/* -static LISceneNode* checkismayacamera(lua_State* L){ - return checkismayacamera(L,1); -} -*/ - static int newiscenemayacamera(lua_State* L){ printf("createing maya camera!\n"); ISceneManager* smgr = device->getSceneManager(); @@ -53,23 +30,11 @@ static int newiscenemayacamera(lua_State* L){ lua_newtable(L);//{} lua_pushlightuserdata(L,cam); lua_setfield(L,-2,"node"); - //LISceneNode* lcam = (LISceneNode*)lua_newuserdata(L, sizeof(LISceneNode)); - //int tref = luaL_ref(L,LUA_REGISTRYINDEX); //Set it's metatable luaL_getmetatable(L, "scene.iscenemayacamera"); lua_setmetatable(L, -2); - //Create the struct - //lcam->n = cam; - //lcam->funcmap = hashmap_new(); - //lcam->type = "iscenemayacamera"; - - //Free up anything made in this function - //free(label); - - //Put it on top and return it - //lua_rawgeti(L,LUA_REGISTRYINDEX,tref); return 1; } diff --git a/src/client/lua_api/scene/igeneric.cpp b/src/client/lua_api/scene/igeneric.cpp index c60aa90..0383619 100644 --- a/src/client/lua_api/scene/igeneric.cpp +++ b/src/client/lua_api/scene/igeneric.cpp @@ -16,15 +16,6 @@ using namespace video; extern IrrlichtDevice* device; -/* -static LISceneNode* toiscenenode(lua_State* L, int index){ - LISceneNode* ret = (LISceneNode*)lua_touserdata(L,index); - if(ret == NULL) - luaL_typerror(L,index,"LISceneNode"); - return ret; -} -*/ - int iscenegetpos(lua_State* L){//{node=ud_IMeshSceneNode} lua_getfield(L,-1,"node");//{node=ud_IMeshSceneNode},ud_IMeshSceneNode ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1);//{node=ud_IMeshSceneNode},ud_IMeshSceneNode @@ -42,8 +33,6 @@ int iscenesetpos(lua_State* L){//{node=ISceneNode},{x,y,z} ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1);//{node=ud_ISceneNode},ud_ISceneNode i->setPosition(vector3df(x,y,z)); i->updateAbsolutePosition(); - //vector3df pos = i->getAbsolutePosition(); - //printf("After setting pos, new pos is %f %f %f",pos.X,pos.Y,pos.Z); lua_pop(L,2);// return 0; } diff --git a/src/client/lua_api/scene/ilight.cpp b/src/client/lua_api/scene/ilight.cpp index 7473bfa..972de83 100644 --- a/src/client/lua_api/scene/ilight.cpp +++ b/src/client/lua_api/scene/ilight.cpp @@ -22,16 +22,6 @@ using namespace core; extern IrrlichtDevice* device; -//static LISceneNode* checkiscenelight(lua_State* L, int index){ - //void* ud = luaL_checkudata(L,index,"scene.ilight"); - //luaL_argcheck(L,ud != NULL, index, "'scene.ilight' expected"); - //return (LISceneNode*) ud; -//} - -//static LISceneNode* checkilight(lua_State* L){ - //return checkiscenelight(L,1); -//} - //{} :: scene.newlight(radius, {v3 position}) static int newiscenelight(lua_State* L){ printf("Createing light!\n"); diff --git a/src/client/lua_api/scene/imesh.cpp b/src/client/lua_api/scene/imesh.cpp index b5c8939..f3b5bc8 100644 --- a/src/client/lua_api/scene/imesh.cpp +++ b/src/client/lua_api/scene/imesh.cpp @@ -23,18 +23,6 @@ using namespace video; extern IrrlichtDevice* device; -//static LISceneNode* checkismesh(lua_State* L, int index){ - //void* ud = luaL_checkudata(L,index,"scene.imesh"); - //luaL_argcheck(L,ud != NULL, index, "'scene.imesh' expected"); - //return (LISceneNode*) ud; -//} - -/* -static LISceneNode* checkismesh(lua_State* L){ - return checkismesh(L,1); -} -*/ - //{} :: scene.newmesh("/path/to/model") static int newiscenemesh(lua_State* L){//"path/to" @@ -90,21 +78,6 @@ int newiscenecube(lua_State* L){//{v3 size}, {v3 origin} return 1; } -// self:setMaterial("path/to/material") -//int iscenesetmaterial(lua_State* L){//self,"path/to" - //ISceneNode* node = (IMeshSceneNode*)lua_touserdata(L,-2); - //const char* s = lua_tostring(L,-1); - ////ISceneNode* i = toiscenenode(L,1)->n; - ////const char* s = luaL_optstring(L,2,"error.png"); - ////printf("Setting material to %s",s); - - //IVideoDriver* driver = device->getVideoDriver(); - //node->setMaterialTexture(0, driver->getTexture(s)); - - //lua_pop(L,2); - //return 0; -//} - static const luaL_reg imesh_m[] = { {"setMaterial", iscenesetmaterial}, {"getpos", iscenegetpos}, -- cgit v1.2.3-70-g09d2