mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
No it doesn't quite work
This commit is contained in:
parent
42e720959e
commit
6b9b5254f3
2 changed files with 10 additions and 3 deletions
|
@ -9,7 +9,7 @@ impl ParticleWorldState {
|
||||||
pub(crate) unsafe fn get_cell(&self, x: i32, y: i32) -> *const c_void {
|
pub(crate) unsafe fn get_cell(&self, x: i32, y: i32) -> *const c_void {
|
||||||
let x = dbg!(x as isize);
|
let x = dbg!(x as isize);
|
||||||
let y = dbg!(y as isize);
|
let y = dbg!(y as isize);
|
||||||
let chunk_index = dbg!((((((y) >> 9) - 256) & 511) * 512 + ((((x) >> 9) - 256) & 511)) * 4);
|
let chunk_index = (((((y) >> 9) - 256) & 511) * 512 + ((((x) >> 9) - 256) & 511)) * 4;
|
||||||
let chunk_arr = self.chunk_map_this.offset(8).cast::<*const c_void>().read();
|
let chunk_arr = self.chunk_map_this.offset(8).cast::<*const c_void>().read();
|
||||||
// dbg!(chunk_arr);
|
// dbg!(chunk_arr);
|
||||||
let chunk = chunk_arr.offset(chunk_index).cast::<*const c_void>().read();
|
let chunk = chunk_arr.offset(chunk_index).cast::<*const c_void>().read();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
local ffi = require("ffi")
|
local ffi = require("ffi")
|
||||||
|
local world_ffi = require("noitapatcher.nsew.world_ffi")
|
||||||
|
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
function module.on_world_initialized()
|
function module.on_world_initialized()
|
||||||
local world_ffi = require("noitapatcher.nsew.world_ffi")
|
|
||||||
local grid_world = world_ffi.get_grid_world()
|
local grid_world = world_ffi.get_grid_world()
|
||||||
local chunk_map = grid_world.vtable.get_chunk_map(grid_world)
|
local chunk_map = grid_world.vtable.get_chunk_map(grid_world)
|
||||||
grid_world = tonumber(ffi.cast("intptr_t", grid_world))
|
grid_world = tonumber(ffi.cast("intptr_t", grid_world))
|
||||||
|
@ -12,9 +12,16 @@ function module.on_world_initialized()
|
||||||
end
|
end
|
||||||
|
|
||||||
function module.on_local_player_spawn()
|
function module.on_local_player_spawn()
|
||||||
|
local grid_world = world_ffi.get_grid_world()
|
||||||
|
local chunk_map = grid_world.vtable.get_chunk_map(grid_world)
|
||||||
local pix_p = ewext.get_pixel_pointer(0, 0)
|
local pix_p = ewext.get_pixel_pointer(0, 0)
|
||||||
|
|
||||||
|
local ppixel = world_ffi.get_cell(chunk_map, 0, 0)
|
||||||
-- assert(pix_p ~= 0)
|
-- assert(pix_p ~= 0)
|
||||||
-- assert(tonumber(ffi.cast("intptr_t", ppixel)) == pix_p)
|
print(tonumber(ffi.cast("intptr_t", ppixel)))
|
||||||
|
print(pix_p)
|
||||||
|
|
||||||
|
assert(tonumber(ffi.cast("intptr_t", ppixel)) == pix_p)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue