Check particle exists in tpt.set_property, and sdl_scale mouse coords for Lua step
This commit is contained in:
parent
36e2a07a5b
commit
c18009dd9c
@ -436,7 +436,7 @@ int luatpt_set_property(lua_State* l)
|
|||||||
for (nx = x; nx<x+w; nx++)
|
for (nx = x; nx<x+w; nx++)
|
||||||
for (ny = y; ny<y+h; ny++){
|
for (ny = y; ny<y+h; ny++){
|
||||||
i = pmap[ny][nx]>>8;
|
i = pmap[ny][nx]>>8;
|
||||||
if (i < 0 || i >= NPART || (partsel && partsel != parts[i].type))
|
if (!(pmap[ny][nx]&0xFF) || i < 0 || i >= NPART || (partsel && partsel != parts[i].type))
|
||||||
continue;
|
continue;
|
||||||
if(format==2){
|
if(format==2){
|
||||||
*((float*)(((void*)&parts[i])+offset)) = f;
|
*((float*)(((void*)&parts[i])+offset)) = f;
|
||||||
@ -455,6 +455,8 @@ int luatpt_set_property(lua_State* l)
|
|||||||
}
|
}
|
||||||
if (i < 0 || i >= NPART)
|
if (i < 0 || i >= NPART)
|
||||||
return luaL_error(l, "Invalid particle ID '%d'", i);
|
return luaL_error(l, "Invalid particle ID '%d'", i);
|
||||||
|
if (!parts[i].type)
|
||||||
|
return 0;
|
||||||
if (partsel && partsel != parts[i].type)
|
if (partsel && partsel != parts[i].type)
|
||||||
return 0;
|
return 0;
|
||||||
if(format==2){
|
if(format==2){
|
||||||
|
@ -2508,7 +2508,7 @@ int main(int argc, char *argv[])
|
|||||||
b = SDL_GetMouseState(&x, &y); // b is current mouse state
|
b = SDL_GetMouseState(&x, &y); // b is current mouse state
|
||||||
|
|
||||||
#ifdef LUACONSOLE
|
#ifdef LUACONSOLE
|
||||||
if(luacon_step(x, y, b, bq, sdl_key))
|
if(luacon_step(x/sdl_scale, y/sdl_scale, b, bq, sdl_key))
|
||||||
b = 0; //Mouse click was handled by Lua step
|
b = 0; //Mouse click was handled by Lua step
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user