some cleanups, direct mode click fix, mouse_pos added
This commit is contained in:
parent
d5cdf74613
commit
98849ee488
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -12,6 +12,7 @@ instead (1.3.5) unstable; urgency=low
|
|||
* -chunksize parameter;
|
||||
* show dir to be deleted while remove game;
|
||||
* theme reset features;
|
||||
* mouse_pos added;
|
||||
|
||||
-- Peter Kosyh <p.kosyh@gmail.com> Tue, 29 Mar 2011 14:08:00 +0300
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ int game_apply_theme(void)
|
|||
|
||||
memset(objs, 0, sizeof(struct el) * el_max);
|
||||
gfx_bg(game_theme.bgcol);
|
||||
if (game_theme.gfx_mode != GFX_MODE_DIRECT)
|
||||
if (!DIRECT_MODE)
|
||||
game_clear(0, 0, game_theme.w, game_theme.h);
|
||||
gfx_flip();
|
||||
lay = txt_layout(game_theme.font, ALIGN_JUSTIFY, game_theme.win_w, game_theme.win_h);
|
||||
|
@ -567,7 +567,7 @@ int game_apply_theme(void)
|
|||
el_set(el_menu, elt_layout, 0, 0, NULL);
|
||||
el_set(el_menu_button, elt_image, game_theme.menu_button_x, game_theme.menu_button_y, game_theme.menu_button);
|
||||
|
||||
if (game_theme.gfx_mode != GFX_MODE_DIRECT) {
|
||||
if (!DIRECT_MODE) {
|
||||
el_draw(el_menu_button);
|
||||
}
|
||||
return 0;
|
||||
|
@ -1706,7 +1706,7 @@ int game_cmd(char *cmd)
|
|||
char *title = NULL;
|
||||
char *pict = NULL;
|
||||
img_t oldscreen = NULL;
|
||||
int dd = (game_theme.gfx_mode == GFX_MODE_DIRECT);
|
||||
int dd = (DIRECT_MODE);
|
||||
int rc = 0;
|
||||
if (menu_shown)
|
||||
return -1;
|
||||
|
@ -1718,7 +1718,7 @@ int game_cmd(char *cmd)
|
|||
game_music_player();
|
||||
game_sound_player();
|
||||
|
||||
if (game_theme.gfx_mode == GFX_MODE_DIRECT) {
|
||||
if (DIRECT_MODE) {
|
||||
if (cmdstr)
|
||||
free(cmdstr);
|
||||
if (game_pict_modify(NULL))
|
||||
|
@ -3036,7 +3036,7 @@ int game_loop(void)
|
|||
game_restart();
|
||||
if (old_menu != -1)
|
||||
game_menu(old_menu);
|
||||
} else if (game_theme.gfx_mode == GFX_MODE_DIRECT && !menu_shown) {
|
||||
} else if (DIRECT_MODE && !menu_shown) {
|
||||
; // nothing todo
|
||||
} else if (!alt_pressed && (!is_key(&ev, "return") || !is_key(&ev, "enter")
|
||||
#ifdef S60
|
||||
|
@ -3130,7 +3130,7 @@ int game_loop(void)
|
|||
select_frame(0);
|
||||
#endif
|
||||
}
|
||||
} else if (game_theme.gfx_mode == GFX_MODE_DIRECT && !menu_shown) {
|
||||
} else if (DIRECT_MODE && !menu_shown) {
|
||||
; // nothing todo
|
||||
} else if (ev.type == MOUSE_DOWN) {
|
||||
if (ev.code != 1)
|
||||
|
@ -3158,7 +3158,7 @@ int game_loop(void)
|
|||
// game_highlight(ev.x, ev.y, 1);
|
||||
}
|
||||
|
||||
if (game_theme.gfx_mode != GFX_MODE_DIRECT || menu_shown) {
|
||||
if (!DIRECT_MODE || menu_shown) {
|
||||
if (old_xref)
|
||||
game_highlight(x, y, 1);
|
||||
else {
|
||||
|
|
|
@ -832,7 +832,7 @@ err:
|
|||
static img_t grab_sprite(const char *dst, int *xoff, int *yoff)
|
||||
{
|
||||
img_t d;
|
||||
if (game_theme.gfx_mode == GFX_MODE_DIRECT && !strcmp(dst, "screen")) {
|
||||
if (DIRECT_MODE && !strcmp(dst, "screen")) {
|
||||
d = gfx_screen(NULL);
|
||||
*xoff = game_theme.xoff;
|
||||
*yoff = game_theme.yoff;
|
||||
|
@ -1234,6 +1234,7 @@ static int luaB_load_sound(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_free_sound(lua_State *L) {
|
||||
const char *fname = luaL_optstring(L, 1, NULL);
|
||||
if (!fname)
|
||||
|
@ -1259,6 +1260,19 @@ static int luaB_channel_sound(lua_State *L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int luaB_mouse_pos(lua_State *L) {
|
||||
int x = -1, y = -1;
|
||||
float v = game_theme.scale;
|
||||
|
||||
gfx_cursor(&x, &y);
|
||||
x = (x - game_theme.xoff) / v;
|
||||
y = (y - game_theme.yoff) / v;
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg base_funcs[] = {
|
||||
{"doencfile", luaB_doencfile},
|
||||
{"dofile", luaB_dofile},
|
||||
|
@ -1276,6 +1290,8 @@ static const luaL_Reg base_funcs[] = {
|
|||
{"sound_free", luaB_free_sound},
|
||||
{"sound_channel", luaB_channel_sound},
|
||||
{"sounds_free", luaB_free_sounds},
|
||||
|
||||
{"mouse_pos", luaB_mouse_pos},
|
||||
|
||||
{"font_load", luaB_load_font},
|
||||
{"font_free", luaB_free_font},
|
||||
|
|
|
@ -156,4 +156,6 @@ extern int theme_relative;
|
|||
#define INV_ALIGN(v) ((v)>>8)
|
||||
#define INV_ALIGN_SET(v) ((v)<<8)
|
||||
|
||||
#define DIRECT_MODE (game_theme.gfx_mode == GFX_MODE_DIRECT)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require "theme"
|
||||
|
||||
click = {
|
||||
nam = 'click';
|
||||
object_type = true;
|
||||
|
@ -14,7 +16,7 @@ stead.module_init(function()
|
|||
function(f, s, press, mb, x, y, px, py, ...)
|
||||
local cmd = 'click '
|
||||
if press then
|
||||
if click.bg then
|
||||
if click.bg or theme.get 'scr.gfx.mode' == 'direct' then
|
||||
cmd = cmd .. x .. ','.. y
|
||||
if px then
|
||||
cmd = cmd .. ','
|
||||
|
|
Loading…
Reference in a new issue