[Add] Updated documentation crap.

[Fix] Warning on 64bit machines.
This commit is contained in:
Allanis 2013-02-15 19:08:38 +00:00
parent e3c2ca72ac
commit a6c9a00cf5
6 changed files with 95 additions and 21 deletions

33
README
View File

@ -35,6 +35,33 @@ already been documented before posting.
Instructions: Instructions:
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
Keys: Keys:
=========================================================
Lephisto uses a dynamic keybinding system that allows you
to configure the keybinds to joystick, keyboard or a mix
of both.
-- Joystick.
If you are going to use a joystick, You will have to tell
Lephisto which joystick to use. You can either use the -j
or -J parameter from the terminal or put it in the conf
file.
-- Eg.
-- ./Lephisto -j 0
-- ./Lephisto -J "Precision"
-- joystick = "Precision" # in conf file.
-- Syntax.
KEY_IDENTIFIER = { type = KEY_TYPE, key = KEY_NUMBER,
[reverse = KEY_REVERSE] }
KEY_IDENTIFIER is the indetifier given below:
KEY_TYPE can be one of keyboard, jaxis or jbutton.
KEY_NUMBER is the number of the key (found with xev)
KEY_REVERSE is whether it is reversed or not, which
is only useful in the case of jaxis.
-- Eg.
accel = { type = "jbutton", key = 0 }
=========================================================
Movement: Movement:
-- w : Accelerate. -- w : Accelerate.
-- a : Left. -- a : Left.
@ -46,6 +73,12 @@ Keys:
-- 'r' : Target closest hostile ship. -- 'r' : Target closest hostile ship.
-- 'f' : Faces the target. -- 'f' : Faces the target.
-- 'b' : Board the target. -- 'b' : Board the target.
-- Left Shift : Fires secondary weapon.
-- 'q' : Switches to the next secondary weapon.
Space:
-- 'p' : Cycles through planets.
-- 'l' : Attempts to land or targets nearest planet.
GUI: GUI:
-- UP : Zoom in. -- UP : Zoom in.

View File

@ -63,4 +63,9 @@ clean:
@echo -e "\tRemoving data.." @echo -e "\tRemoving data.."
rm -rf $(OBJS) $(APPNAME) $(DATA) pack core mksprite *.out a.txt rm -rf $(OBJS) $(APPNAME) $(DATA) pack core mksprite *.out a.txt
#rm -rf ../lib/lua/*.o ../lib/lua/*.a #rm -rf ../lib/lua/*.o ../lib/lua/*.a
@echo -e "\tCleaning utils."
@(cd ../utils/pack; $(MAKE) clean)
@(cd ../utils/mkspr; $(MAKE) clean)
@echo -e "\tCleaning Lua"
@(cd ../lib/lua; $(MAKE) clean)

View File

@ -16,12 +16,25 @@ joystick = "Precision"
-- If left is an axis, it will automatically set right to the same axis. -- If left is an axis, it will automatically set right to the same axis.
-- setting both to the same axis (key). -- setting both to the same axis (key).
-- You can use reverse = 1 option to reverse them. -- You can use reverse = 1 option to reverse them.
-- Movement.
accel = { type = "jbutton", key = 0 } accel = { type = "jbutton", key = 0 }
left = { type = "jaxis", key = 0 } left = { type = "jaxis", key = 0 }
right = { type = "jaxis", key = 0 } right = { type = "jaxis", key = 0 }
-- Combat.
primary = { type = "jbutton", key = 1 } primary = { type = "jbutton", key = 1 }
target = { type = "jbutton", key = 4 } target = { type = "jbutton", key = 4 }
target_nearest = { type = "jbutton", key = 3 } target_nearest = { type = "jbutton", key = 3 }
mapzoomin = { type = "jbutton", key = 7 } face = { type = "keyboard", key = 38 }
mapzoomout = { type = "jbuton", key = 6 } board = { type = "keyboard", key = 57 }
secondary = { type = "jbutton", key = 7 }
secondary_next = { type = "jbutotn", key = 5 }
-- Space.
-- Gui.
mapzoomin = { type = "jbutton", key = 4 }
mapzoomout = { type = "jbuton", key = 6 }
screenshot = { type = "keyboard", key = 82 }

View File

@ -517,7 +517,7 @@ static int ai_exists(lua_State* L) {
MIN_ARGS(1); MIN_ARGS(1);
if(lua_isnumber(L,1)) { if(lua_isnumber(L,1)) {
lua_pushboolean(L, (int)pilot_get((unsigned int)lua_tonumber(L,1))); lua_pushboolean(L, (pilot_get((unsigned int)lua_tonumber(L,1)) != NULL)?1:0);
return 1; return 1;
} }
return 0; return 0;

View File

@ -95,30 +95,44 @@ int main(int argc, char** argv) {
if(luaL_dofile(L, CONF_FILE) == 0) { // Conf file exists. if(luaL_dofile(L, CONF_FILE) == 0) { // Conf file exists.
// Global. // Global.
lua_getglobal(L, "data"); lua_getglobal(L, "data");
if(lua_isstring(L, -1)) if(lua_isstring(L, -1)) {
data = strdup((char*)lua_tostring(L, -1)); data = strdup((char*)lua_tostring(L, -1));
lua_remove(L, -1);
}
// OpenGL properties. // OpenGL properties.
lua_getglobal(L, "width"); lua_getglobal(L, "width");
if(lua_isnumber(L, -1)) if(lua_isnumber(L, -1)) {
gl_screen.w = (int)lua_tonumber(L, -1); gl_screen.w = (int)lua_tonumber(L, -1);
lua_remove(L, -1);
}
lua_getglobal(L, "height"); lua_getglobal(L, "height");
if(lua_isnumber(L, -1)) if(lua_isnumber(L, -1)) {
gl_screen.h = (int)lua_tonumber(L, -1); gl_screen.h = (int)lua_tonumber(L, -1);
lua_remove(L, -1);
}
lua_getglobal(L, "fullscreen"); lua_getglobal(L, "fullscreen");
if(lua_isnumber(L, -1)) if(lua_isnumber(L, -1))
if((int)lua_tonumber(L, -1) == 1) if((int)lua_tonumber(L, -1) == 1) {
gl_screen.fullscreen = 1; gl_screen.fullscreen = 1;
lua_remove(L, -1);
}
lua_getglobal(L, "fps"); lua_getglobal(L, "fps");
if(lua_isnumber(L, -1)) if(lua_isnumber(L, -1)) {
max_fps = (int)lua_tonumber(L, -1); max_fps = (int)lua_tonumber(L, -1);
lua_remove(L, -1);
}
// Joystick. // Joystick.
lua_getglobal(L, "joystick"); lua_getglobal(L, "joystick");
if(lua_isnumber(L, -1)) if(lua_isnumber(L, -1)) {
indjoystick = (int)lua_tonumber(L, -1); indjoystick = (int)lua_tonumber(L, -1);
else if(lua_isstring(L, -1)) lua_remove(L, -1);
}
else if(lua_isstring(L, -1)) {
namjoystick = strdup((char*)lua_tostring(L, -1)); namjoystick = strdup((char*)lua_tostring(L, -1));
lua_remove(L, -1);
}
// Grab the keybindings if there are any. // Grab the keybindings if there are any.
char* str; char* str;
@ -160,6 +174,12 @@ int main(int argc, char** argv) {
// Set the keybind. // Set the keybind.
input_setKeybind((char*)keybindNames[i], type, key, reverse); input_setKeybind((char*)keybindNames[i], type, key, reverse);
} else WARN("Malformed keybind in %s", CONF_FILE); } else WARN("Malformed keybind in %s", CONF_FILE);
// Clean up after table stuff.
lua_remove(L, -1);
lua_remove(L, -1);
lua_remove(L, -1);
lua_remove(L, -1);
} }
} }
} }

View File

@ -16,3 +16,6 @@ all:
@$(CC) $(LFLAGS) $(CFLAGS) -o $(ROOTDIR)$(APPNAME) main.c $(COBJS) @$(CC) $(LFLAGS) $(CFLAGS) -o $(ROOTDIR)$(APPNAME) main.c $(COBJS)
@echo -e "\tLD $(APPNAME)" @echo -e "\tLD $(APPNAME)"
clean:
rm -rf *.o