Cleanup a bit.

This commit is contained in:
IQuant 2024-09-27 17:46:42 +03:00
parent fb4a392b97
commit b9291ba212
4 changed files with 7 additions and 93 deletions

View file

@ -36,7 +36,7 @@ extern "C" fn init_particle_world_state(lua: *mut lua_State) -> c_int {
STATE.with(|state| {
state.borrow_mut().particle_world_state = Some(ParticleWorldState {
world_ptr: world_pointer as *mut c_void,
_world_ptr: world_pointer as *mut c_void,
chunk_map_ptr: chunk_map_pointer as *mut c_void,
material_list_ptr: material_list_pointer as _,
});
@ -44,19 +44,6 @@ extern "C" fn init_particle_world_state(lua: *mut lua_State) -> c_int {
0
}
extern "C" fn get_pixel_pointer(lua: *mut lua_State) -> c_int {
let x = unsafe { LUA.lua_tointeger(lua, 1) } as i32;
let y = unsafe { LUA.lua_tointeger(lua, 2) } as i32;
STATE.with(|state| {
let state = state.borrow_mut();
let pws = state.particle_world_state.as_ref().unwrap();
// let pixel_pointer = pws.get_cell_raw(x, y);
// unsafe { LUA.lua_pushinteger(lua, pixel_pointer as isize) };
});
1
}
extern "C" fn encode_area(lua: *mut lua_State) -> c_int {
let start_x = unsafe { LUA.lua_tointeger(lua, 1) } as i32;
let start_y = unsafe { LUA.lua_tointeger(lua, 2) } as i32;
@ -81,8 +68,6 @@ pub extern "C" fn luaopen_ewext(lua: *mut lua_State) -> c_int {
LUA.lua_pushcclosure(lua, Some(init_particle_world_state), 0);
LUA.lua_setfield(lua, -2, c"init_particle_world_state".as_ptr());
// LUA.lua_pushcclosure(lua, Some(get_pixel_pointer), 0);
// LUA.lua_setfield(lua, -2, c"get_pixel_pointer".as_ptr());
LUA.lua_pushcclosure(lua, Some(encode_area), 0);
LUA.lua_setfield(lua, -2, c"encode_area".as_ptr());
}

View file

@ -1,4 +1,4 @@
use std::{ffi::c_void, mem, ptr::null};
use std::{ffi::c_void, mem};
mod ntypes;
@ -76,7 +76,7 @@ impl<Pixel: Eq + Copy> PixelRunner<Pixel> {
}
pub(crate) struct ParticleWorldState {
pub(crate) world_ptr: *mut c_void,
pub(crate) _world_ptr: *mut c_void,
pub(crate) chunk_map_ptr: *mut c_void,
pub(crate) material_list_ptr: *const c_void,
}

View file

@ -1,6 +1,6 @@
// Type defs borrowed from NoitaPatcher.
use std::ffi::{c_char, c_void};
use std::ffi::c_char;
pub(crate) const CELLDATA_SIZE: isize = 0x290;
@ -15,6 +15,7 @@ pub(crate) struct StdString {
#[repr(u32)]
#[derive(Debug, PartialEq, Clone, Copy)]
#[expect(dead_code)]
pub(crate) enum CellType {
None = 0,
Liquid = 1,