mirror of
https://github.com/jndean/IPUDOOM.git
synced 2026-10-30 19:04:27 +00:00
Sync player position to IPU on tic, finish init of AM (excluding loadPics)
This commit is contained in:
1 parent
b07f036aa2
commit
2a04c2d52d
9 files changed
+72
-30
No files matched your search
@@ -25,7 +25,7 @@ CPU_FLAGS = -I src -I /usr/local/include/SDL2 -I/usr/include/libpng16 -I/opt/pop
|
||||
|
||||
IPU_FLAGS = -I src/ipu \
|
||||
-Wall -Werror -Wno-unused-variable \
|
||||
-O2
|
||||
-O2
|
||||
|
||||
|
||||
all: build build/doom build/ipu_rt.gp
|
||||
|
||||
@@ -706,6 +706,7 @@ void TryRunTics (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
// G_Responder is called in here
|
||||
NetUpdate ();
|
||||
}
|
||||
|
||||
@@ -790,6 +791,7 @@ void TryRunTics (void)
|
||||
|
||||
memcpy(local_playeringame, set->ingame, sizeof(local_playeringame));
|
||||
|
||||
// G_Ticker is called in here
|
||||
// JOSEF: loop_interface->RunTic(set->cmds, set->ingame);
|
||||
D_RunTic(set->cmds, set->ingame); // JOSEF
|
||||
gametic++;
|
||||
|
||||
+35
-7
@@ -8,6 +8,7 @@
|
||||
#include "st_stuff.h"
|
||||
|
||||
#include "ipu_print.h"
|
||||
#include "ipu_interface.h"
|
||||
|
||||
|
||||
// For use if I do walls with outsides/insides
|
||||
@@ -196,7 +197,11 @@ static fixed_t scale_mtof = (fixed_t)INITSCALEMTOF;
|
||||
// used by FTOM to scale from frame-buffer-to-map coords (=1/scale_mtof)
|
||||
static fixed_t scale_ftom;
|
||||
|
||||
static player_t *plr; // the player represented by an arrow
|
||||
// JOSEF: Map only uses player position, so don't need reference to full
|
||||
// player object (which will be on a different IPU tile).
|
||||
// May need mechanism for sending plr->message to rendering tile... LATER
|
||||
// static player_t *plr; // the player represented by an arrow
|
||||
IPUPlayerPos_t am_playerpos;
|
||||
|
||||
static patch_t *marknums[10]; // numbers used for marking by the automap
|
||||
static mpoint_t markpoints[AM_NUMMARKPOINTS]; // where the points are
|
||||
@@ -246,6 +251,32 @@ void AM_findMinMaxBoundaries(void) {
|
||||
max_scale_mtof = FixedDiv(f_h << FRACBITS, 2 * PLAYERRADIUS);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
void AM_changeWindowLoc(void) {
|
||||
if (m_paninc.x || m_paninc.y) {
|
||||
followplayer = 0;
|
||||
f_oldloc.x = INT_MAX;
|
||||
}
|
||||
|
||||
m_x += m_paninc.x;
|
||||
m_y += m_paninc.y;
|
||||
|
||||
if (m_x + m_w / 2 > max_x)
|
||||
m_x = max_x - m_w / 2;
|
||||
else if (m_x + m_w / 2 < min_x)
|
||||
m_x = min_x - m_w / 2;
|
||||
|
||||
if (m_y + m_h / 2 > max_y)
|
||||
m_y = max_y - m_h / 2;
|
||||
else if (m_y + m_h / 2 < min_y)
|
||||
m_y = min_y - m_h / 2;
|
||||
|
||||
m_x2 = m_x + m_w;
|
||||
m_y2 = m_y + m_h;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -283,11 +314,9 @@ void AM_initVariables(void) {
|
||||
}
|
||||
*/
|
||||
|
||||
/* LATER:
|
||||
plr = ... copy from CPU
|
||||
|
||||
m_x = plr->mo->x - m_w / 2;
|
||||
m_y = plr->mo->y - m_h / 2;
|
||||
m_x = am_playerpos.x - m_w / 2;
|
||||
m_y = am_playerpos.y - m_h / 2;
|
||||
AM_changeWindowLoc();
|
||||
|
||||
// for saving & restoring
|
||||
@@ -295,7 +324,6 @@ void AM_initVariables(void) {
|
||||
old_m_y = m_y;
|
||||
old_m_w = m_w;
|
||||
old_m_h = m_h;
|
||||
*/
|
||||
|
||||
// inform the status bar of the change
|
||||
// ST_Responder(&st_notify); // JOSEF
|
||||
@@ -358,7 +386,7 @@ void AM_Start(void) {
|
||||
lastlevel = gamemap;
|
||||
lastepisode = gameepisode;
|
||||
}
|
||||
AM_initVariables(); /// JOSEF Not Finished
|
||||
AM_initVariables();
|
||||
// AM_loadPics(); // LATER
|
||||
ipuprint("Starting automap");
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ extern "C" {
|
||||
#include "d_event.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
#include "m_fixed.h"
|
||||
#include "tables.h"
|
||||
|
||||
|
||||
#define IPUMAXLUMPBYTES 32000
|
||||
@@ -21,8 +23,14 @@ typedef struct {
|
||||
int lumpnum;
|
||||
} G_LoadLevel_MiscValues_t;
|
||||
|
||||
typedef struct {
|
||||
fixed_t x, y, z;
|
||||
angle_t angle;
|
||||
} IPUPlayerPos_t;
|
||||
|
||||
typedef struct {
|
||||
gamestate_t gamestate;
|
||||
IPUPlayerPos_t player_mobj;
|
||||
} G_Ticker_MiscValues_t;
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// #include "w_wad.h"
|
||||
|
||||
#include "ipu_interface.h"
|
||||
#include "ipu_transfer.h"
|
||||
|
||||
int gamelumpnum;
|
||||
int requestedlumpnum;
|
||||
@@ -14,6 +15,12 @@ void IPU_G_LoadLevel_UnpackMiscValues(G_LoadLevel_MiscValues_t* pack) {
|
||||
|
||||
void IPU_G_Ticker_UnpackMiscValues(G_Ticker_MiscValues_t* pack) {
|
||||
gamestate = pack->gamestate;
|
||||
if (gamestate == GS_LEVEL) {
|
||||
am_playerpos.x = pack->player_mobj.x;
|
||||
am_playerpos.y = pack->player_mobj.y;
|
||||
am_playerpos.z = pack->player_mobj.z;
|
||||
am_playerpos.angle = pack->player_mobj.angle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,11 +9,12 @@ extern "C" {
|
||||
|
||||
extern int gamelumpnum;
|
||||
extern int requestedlumpnum;
|
||||
extern IPUPlayerPos_t am_playerpos;
|
||||
|
||||
void IPU_G_LoadLevel_UnpackMiscValues(G_LoadLevel_MiscValues_t* pack);
|
||||
void IPU_G_Ticker_UnpackMiscValues(G_Ticker_MiscValues_t* pack);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+6
-19
@@ -104,17 +104,6 @@ void IpuDoom::buildIpuGraph() {
|
||||
poplar::program::Copy(ipuFrame, frameOutStream),
|
||||
});
|
||||
|
||||
// -------- AM_LevelInit_CS ------ //
|
||||
|
||||
poplar::ComputeSet AM_LevelInit_CS = m_ipuGraph.addComputeSet("AM_LevelInit_CS");
|
||||
vtx = m_ipuGraph.addVertex(AM_LevelInit_CS, "AM_LevelInit_Vertex", {});
|
||||
m_ipuGraph.setTileMapping(vtx, 0);
|
||||
m_ipuGraph.setPerfEstimate(vtx, 10000000);
|
||||
|
||||
poplar::program::Sequence AM_LevelInit_prog({
|
||||
poplar::program::Execute(AM_LevelInit_CS),
|
||||
});
|
||||
|
||||
// -------- IPU_G_DoLoadLevel ------ //
|
||||
|
||||
m_miscValuesBuf = m_ipuGraph.addVariable(poplar::UNSIGNED_CHAR, {(ulong)IPUMISCVALUESSIZE}, "miscValues");
|
||||
@@ -202,7 +191,6 @@ void IpuDoom::buildIpuGraph() {
|
||||
printf("Creating engine...\n");
|
||||
m_ipuEngine = std::make_unique<poplar::Engine>(std::move(poplar::Engine(
|
||||
m_ipuGraph, {
|
||||
AM_LevelInit_prog,
|
||||
AM_Drawer_prog,
|
||||
G_DoLoadLevel_prog,
|
||||
G_Ticker_prog,
|
||||
@@ -227,7 +215,6 @@ void IpuDoom::buildIpuGraph() {
|
||||
m_ipuEngine->load(m_ipuDevice);
|
||||
}
|
||||
|
||||
// void IpuDoom::run_AM_LevelInit() { m_ipuEngine->run(0); }
|
||||
void IpuDoom::run_AM_Drawer() {
|
||||
static bool setup = true;
|
||||
if (setup) {
|
||||
@@ -235,13 +222,13 @@ void IpuDoom::run_AM_Drawer() {
|
||||
m_ipuEngine->connectStream("frame-instream", I_VideoBuffer);
|
||||
m_ipuEngine->connectStream("frame-outstream", I_VideoBuffer);
|
||||
}
|
||||
m_ipuEngine->run(1);
|
||||
m_ipuEngine->run(0);
|
||||
}
|
||||
void IpuDoom::run_G_DoLoadLevel() { IPU_G_LoadLevel_PackMiscValues(m_miscValuesBuf_h); m_ipuEngine->run(2); }
|
||||
void IpuDoom::run_G_Ticker() { IPU_G_Ticker_PackMiscValues(m_miscValuesBuf_h); m_ipuEngine->run(3); }
|
||||
void IpuDoom::run_G_Responder(G_Responder_MiscValues_t* buf) {
|
||||
memcpy(m_miscValuesBuf_h, buf, sizeof(G_Responder_MiscValues_t));
|
||||
m_ipuEngine->run(4);
|
||||
void IpuDoom::run_G_DoLoadLevel() { IPU_G_LoadLevel_PackMiscValues(m_miscValuesBuf_h); m_ipuEngine->run(1); }
|
||||
void IpuDoom::run_G_Ticker() { IPU_G_Ticker_PackMiscValues(m_miscValuesBuf_h); m_ipuEngine->run(2); }
|
||||
void IpuDoom::run_G_Responder(G_Responder_MiscValues_t* src_buf) {
|
||||
IPU_G_Responder_PackMiscValues(src_buf, m_miscValuesBuf_h);
|
||||
m_ipuEngine->run(3);
|
||||
}
|
||||
|
||||
static std::unique_ptr<IpuDoom> ipuDoomInstance = nullptr;
|
||||
|
||||
+10
-2
@@ -30,15 +30,23 @@ void IPU_G_LoadLevel_PackMiscValues(void* buf) {
|
||||
memcpy(buf, &pack, sizeof(pack));
|
||||
}
|
||||
|
||||
|
||||
void IPU_G_Ticker_PackMiscValues(void* buf) {
|
||||
assert(sizeof(G_Ticker_MiscValues_t) <= IPUMISCVALUESSIZE);
|
||||
|
||||
G_Ticker_MiscValues_t* pack = (G_Ticker_MiscValues_t*) buf;
|
||||
pack->gamestate = gamestate;
|
||||
|
||||
if (gamestate == GS_LEVEL) {
|
||||
pack->player_mobj.x = players[consoleplayer].mo->x;
|
||||
pack->player_mobj.y = players[consoleplayer].mo->y;
|
||||
pack->player_mobj.z = players[consoleplayer].mo->z;
|
||||
pack->player_mobj.angle = players[consoleplayer].mo->angle;
|
||||
}
|
||||
}
|
||||
|
||||
void IPU_G_Responder_PackMiscValues(void* src_buf, void* dst_buf) {
|
||||
assert(sizeof(G_Responder_MiscValues_t) <= IPUMISCVALUESSIZE);
|
||||
memcpy(dst_buf, src_buf, sizeof(G_Responder_MiscValues_t));
|
||||
}
|
||||
|
||||
void IPU_LoadLumpForTransfer(int lumpnum, byte* buf) {
|
||||
int size = W_LumpLength(lumpnum);
|
||||
|
||||
@@ -10,6 +10,7 @@ extern "C" {
|
||||
|
||||
void IPU_G_LoadLevel_PackMiscValues(void* buf);
|
||||
void IPU_G_Ticker_PackMiscValues(void* buf);
|
||||
void IPU_G_Responder_PackMiscValues(void* src_buf, void* dst_buf);
|
||||
void IPU_LoadLumpForTransfer(int lumpnum, byte* buf);
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user