Many bug fixes
This commit is contained in:
parent
e87417603e
commit
db46d5506c
@ -1017,7 +1017,7 @@ void game_killentity(uint16_t eid) {
|
|||||||
if(cr) {
|
if(cr) {
|
||||||
if(cr->cache) {
|
if(cr->cache) {
|
||||||
if(resman_rev(cr->cache)) {
|
if(resman_rev(cr->cache)) {
|
||||||
resman_unref(RESMAN_MODEL, cr->cache);
|
resman_unref_ptr(RESMAN_MODEL, cr->cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
src/k4.h
2
src/k4.h
@ -45,3 +45,5 @@ void k4_set_texture_reduction(int);
|
|||||||
|
|
||||||
void k4_set_clipboard_text(const char *str);
|
void k4_set_clipboard_text(const char *str);
|
||||||
const char *k4_get_clipboard_text();
|
const char *k4_get_clipboard_text();
|
||||||
|
|
||||||
|
void k4_set_ui_mode(bool yes);
|
||||||
|
|||||||
10
src/luaapi.c
10
src/luaapi.c
@ -1294,7 +1294,7 @@ static int game_get(lua_State *L) {
|
|||||||
if(UiActive) {
|
if(UiActive) {
|
||||||
struct menuitem *item = lua_newuserdata(L, sizeof(*item));
|
struct menuitem *item = lua_newuserdata(L, sizeof(*item));
|
||||||
item->type = MENUITEM_SCREEN;
|
item->type = MENUITEM_SCREEN;
|
||||||
item->ptr = UiActive;
|
item->ptr = (struct k3MObj*) UiActive;
|
||||||
} else {
|
} else {
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
}
|
}
|
||||||
@ -1317,16 +1317,16 @@ static int game_set(lua_State *L) {
|
|||||||
LuaapiFar = lua_tonumber(L, 3);
|
LuaapiFar = lua_tonumber(L, 3);
|
||||||
} else if(!strcmp(i, "menu")) {
|
} else if(!strcmp(i, "menu")) {
|
||||||
struct menuitem *item = lua_touserdata(L, 3);
|
struct menuitem *item = lua_touserdata(L, 3);
|
||||||
UiActive = item ? item->ptr : NULL;
|
UiActive = item ? (struct k3MScreen*) item->ptr : NULL;
|
||||||
|
|
||||||
set_ui_mode(!!UiActive);
|
k4_set_ui_mode(!!UiActive);
|
||||||
|
|
||||||
if(UiActive) {
|
if(UiActive) {
|
||||||
UiActive->w = UiActive->wDesired = GameWndW;
|
UiActive->w = UiActive->wDesired = GameWndW;
|
||||||
UiActive->h = UiActive->hDesired = GameWndH;
|
UiActive->h = UiActive->hDesired = GameWndH;
|
||||||
|
|
||||||
k3MMeasure(UiActive);
|
k3MMeasure((struct k3MObj*) UiActive);
|
||||||
k3MArrange(UiActive);
|
k3MArrange((struct k3MObj*) UiActive);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lua_pushvalue(L, 2);
|
lua_pushvalue(L, 2);
|
||||||
|
|||||||
10
src/main.c
10
src/main.c
@ -28,6 +28,7 @@
|
|||||||
#include"k3font.h"
|
#include"k3font.h"
|
||||||
#include"k3menu.h"
|
#include"k3menu.h"
|
||||||
#include"k3bloom.h"
|
#include"k3bloom.h"
|
||||||
|
#include"k3batch.h"
|
||||||
|
|
||||||
#include"resman.h"
|
#include"resman.h"
|
||||||
|
|
||||||
@ -37,6 +38,7 @@
|
|||||||
|
|
||||||
#include"net_server.h"
|
#include"net_server.h"
|
||||||
#include"net_client.h"
|
#include"net_client.h"
|
||||||
|
#include"net_hi.h"
|
||||||
|
|
||||||
#include<ctype.h>
|
#include<ctype.h>
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ static double LastTime;
|
|||||||
|
|
||||||
#include"loaders.inc"
|
#include"loaders.inc"
|
||||||
|
|
||||||
void set_ui_mode(int yes) {
|
void k4_set_ui_mode(bool yes) {
|
||||||
glfwSetInputMode(GameWnd, GLFW_CURSOR, yes ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED);
|
glfwSetInputMode(GameWnd, GLFW_CURSOR, yes ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +132,7 @@ static void motioncallback(GLFWwindow *GameWnd, double xpos, double ypos) {
|
|||||||
static void keycallback(GLFWwindow *GameWnd, int key, int scancode, int action, int mods) {
|
static void keycallback(GLFWwindow *GameWnd, int key, int scancode, int action, int mods) {
|
||||||
if(action == GLFW_RELEASE && key == GLFW_KEY_ESCAPE) {
|
if(action == GLFW_RELEASE && key == GLFW_KEY_ESCAPE) {
|
||||||
luaapi_escape();
|
luaapi_escape();
|
||||||
set_ui_mode(!!UiActive);
|
k4_set_ui_mode(!!UiActive);
|
||||||
} else {
|
} else {
|
||||||
if(UiActive) {
|
if(UiActive) {
|
||||||
struct k3MEvent ev = {
|
struct k3MEvent ev = {
|
||||||
@ -205,7 +207,7 @@ void k4k3LogCallback(enum k3LogLevel lvl, const char *str, size_t len) {
|
|||||||
|
|
||||||
//if(lvl == k3_ERR) raise(SIGINT);
|
//if(lvl == k3_ERR) raise(SIGINT);
|
||||||
|
|
||||||
fprintf(stderr, "%s : %s\n", prefixes[lvl], str);
|
fprintf(stdout, "%s : %s\n", prefixes[lvl], str);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct k4Control {
|
struct k4Control {
|
||||||
@ -320,7 +322,7 @@ static void fix_resol() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void eng_ui_init() {
|
static void eng_ui_init() {
|
||||||
set_ui_mode(!!UiActive);
|
k4_set_ui_mode(!!UiActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fps_counter_step(double newDT) {
|
static void fps_counter_step(double newDT) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user