aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz/extantz.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-06-01 18:42:37 +1000
committerDavid Walter Seikel2014-06-01 18:42:37 +1000
commitf0cce6bd0e7bfafcaf91df0dccd16f43cba1ea4b (patch)
treefcb1688da21eca15a7334e04dfd1cb029450d2db /src/extantz/extantz.c
parentTODO++ (diff)
downloadSledjHamr-f0cce6bd0e7bfafcaf91df0dccd16f43cba1ea4b.zip
SledjHamr-f0cce6bd0e7bfafcaf91df0dccd16f43cba1ea4b.tar.gz
SledjHamr-f0cce6bd0e7bfafcaf91df0dccd16f43cba1ea4b.tar.bz2
SledjHamr-f0cce6bd0e7bfafcaf91df0dccd16f43cba1ea4b.tar.xz
Get the from disk sim loading to work.
Still an odd problem with sonic that doesn't make sense.
Diffstat (limited to 'src/extantz/extantz.c')
-rw-r--r--src/extantz/extantz.c58
1 files changed, 45 insertions, 13 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c
index 835429f..e102165 100644
--- a/src/extantz/extantz.c
+++ b/src/extantz/extantz.c
@@ -11,7 +11,7 @@ static void on_pixels(void *data, Evas_Object *obj);
11int logDom = -1; // Our logging domain. 11int logDom = -1; // Our logging domain.
12globals ourGlobals; 12globals ourGlobals;
13static Eina_Strbuf *serverStream; 13static Eina_Strbuf *serverStream;
14static char *myKey = "12345678-1234-4321-abcd-0123456789ab"; 14//static char *myKey = "12345678-1234-4321-abcd-0123456789ab";
15//static char *myName = "onefang rejected"; 15//static char *myName = "onefang rejected";
16 16
17 17
@@ -22,20 +22,11 @@ static Eina_Bool _add(void *data, int type, Ecore_Con_Event_Server_Add *ev)
22 22
23 PI("Connected to love server."); 23 PI("Connected to love server.");
24 ourGlobals->server = ev->server; 24 ourGlobals->server = ev->server;
25
26 // Pretend we logged in.
27 strcpy(ourGlobals->uuid, myKey);
28
29 if (ourGlobals->LSLGuiMess) ourGlobals->LSLGuiMess->server = ourGlobals->server; 25 if (ourGlobals->LSLGuiMess) ourGlobals->LSLGuiMess->server = ourGlobals->server;
30 if (ourGlobals->purkle) ourGlobals->purkle->server = ourGlobals->server; 26 if (ourGlobals->purkle) ourGlobals->purkle->server = ourGlobals->server;
31 27
32 Evas_3D_Demo_add(ourGlobals); 28 // TODO - If this is not a local love server, we should attempt to log in here.
33 // TODO - Just a temporary hack so Irrlicht and Evas_3D can share the camera move. 29 // Or attempt a hypergrid style TP.
34 ourGlobals->gld.move = ourGlobals->scene->move;
35 evas_object_data_set(elm_image_object_get(ourGlobals->scene->image), "glob", ourGlobals);
36 evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals->scene->image), on_pixels, ourGlobals);
37 // Setup our callback for clicking in world.
38 ourGlobals->scene->clickCb = _onWorldClick;
39 30
40 return ECORE_CALLBACK_RENEW; 31 return ECORE_CALLBACK_RENEW;
41} 32}
@@ -96,6 +87,40 @@ static Eina_Bool _data(void *data, int type, Ecore_Con_Event_Server_Data *ev)
96 PE("No LSLGuiMess to send - %s", command); 87 PE("No LSLGuiMess to send - %s", command);
97 88
98 } 89 }
90 else if (0 == strncmp(command, "loadSim(", 8))
91 {
92 char *p, *t;
93 int scenriLua;
94
95 // Pretend we logged in. Actually in the case of a local love server, we realy have logged in now.
96 strcpy(ourGlobals->uuid, SID);
97 PI("Your UUID is %s.", ourGlobals->uuid);
98 strcpy(buf, &command[8]);
99 p = buf;
100 while ('"' == p[0])
101 p++;
102 while ('\'' == p[0])
103 p++;
104 t = p;
105 while (('"' != p[0]) && ('\'' != p[0]))
106 p++;
107 p[0] = '\0';
108 // TODO - For now, assume it's a file:// URL.
109 t += 7;
110 //strcat(t, "/index.omg");
111 PI("Loading local sim from %s", t);
112
113 // TODO - Later do the same with eet files in C code, but keep both implementations.
114 lua_getglobal(ourGlobals->scene->L, "package");
115 lua_getfield(ourGlobals->scene->L, lua_gettop(ourGlobals->scene->L), "loaded");
116 lua_remove(ourGlobals->scene->L, -2); // Removes "package"
117 lua_getfield(ourGlobals->scene->L, lua_gettop(ourGlobals->scene->L), "scenriLua");
118 lua_remove(ourGlobals->scene->L, -2); // Removes "loaded"
119 scenriLua = lua_gettop(ourGlobals->scene->L);
120
121 push_lua(ourGlobals->scene->L, "@ ( $ $ )", scenriLua, "loadSim", t);
122// Evas_3D_Demo_add(ourGlobals, t);
123 }
99 else 124 else
100 { 125 {
101 PI("Some random command %s", command); 126 PI("Some random command %s", command);
@@ -587,7 +612,6 @@ EAPI_MAIN int elm_main(int argc, char **argv)
587 if (!ephysics_init()) 612 if (!ephysics_init())
588 return 1; 613 return 1;
589 614
590 eina_clist_init(&(ourGlobals.stuffs));
591 gld = &ourGlobals.gld; 615 gld = &ourGlobals.gld;
592 gldata_init(gld); 616 gldata_init(gld);
593 617
@@ -662,6 +686,14 @@ EAPI_MAIN int elm_main(int argc, char **argv)
662 686
663 init_evas_gl(&ourGlobals); 687 init_evas_gl(&ourGlobals);
664 688
689 // Setup our Evas_3D stuff.
690 ourGlobals.scene = scenriAdd(ourGlobals.win);
691 // TODO - Just a temporary hack so Irrlicht and Evas_3D can share the camera move.
692 ourGlobals.gld.move = ourGlobals.scene->move;
693 evas_object_data_set(elm_image_object_get(ourGlobals.scene->image), "glob", &ourGlobals);
694 evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals.scene->image), on_pixels, &ourGlobals);
695 ourGlobals.scene->clickCb = _onWorldClick;
696
665 // Gotta do this after adding the windows, otherwise the menu renders under the window. 697 // Gotta do this after adding the windows, otherwise the menu renders under the window.
666 // This sucks, gotta redefine this menu each time we create a new window? 698 // This sucks, gotta redefine this menu each time we create a new window?
667 // Also, GL focus gets lost when any menu is used. sigh 699 // Also, GL focus gets lost when any menu is used. sigh