diff --git a/source/duke3d/src/anim.cpp b/source/duke3d/src/anim.cpp index eec76601a..ee18852ff 100644 --- a/source/duke3d/src/anim.cpp +++ b/source/duke3d/src/anim.cpp @@ -323,7 +323,7 @@ int32_t Anim_Play(const char *fn) if (!pic) break; // no more pics! - VM_OnEventWithReturn(EVENT_PRECUTSCENE, -1, myconnectindex, framenum); + VM_OnEventWithReturn(EVENT_PRECUTSCENE, g_player[screenpeek].ps->i, screenpeek, framenum); clearallviews(0); @@ -331,7 +331,7 @@ int32_t Anim_Play(const char *fn) animvpx_render_frame(&codec); - VM_OnEventWithReturn(EVENT_CUTSCENE, -1, myconnectindex, framenum); + VM_OnEventWithReturn(EVENT_CUTSCENE, g_player[screenpeek].ps->i, screenpeek, framenum); // after rendering the frame but before displaying: maybe play sound... framenum++; @@ -374,7 +374,7 @@ int32_t Anim_Play(const char *fn) { G_HandleAsync(); - if (VM_OnEventWithReturn(EVENT_SKIPCUTSCENE, -1, myconnectindex, I_CheckAllInput())) + if (VM_OnEventWithReturn(EVENT_SKIPCUTSCENE, g_player[screenpeek].ps->i, screenpeek, I_CheckAllInput())) { running = 0; break; @@ -472,12 +472,12 @@ int32_t Anim_Play(const char *fn) if (totalclock < ototalclock - 1) continue; - i = VM_OnEventWithReturn(EVENT_PRECUTSCENE, -1, myconnectindex, i); + i = VM_OnEventWithReturn(EVENT_PRECUTSCENE, g_player[screenpeek].ps->i, screenpeek, i); waloff[TILE_ANIM] = (intptr_t)ANIM_DrawFrame(i); invalidatetile(TILE_ANIM, 0, 1 << 4); // JBF 20031228 - if (VM_OnEventWithReturn(EVENT_SKIPCUTSCENE, -1, myconnectindex, I_CheckAllInput())) + if (VM_OnEventWithReturn(EVENT_SKIPCUTSCENE, g_player[screenpeek].ps->i, screenpeek, I_CheckAllInput())) { running = 0; goto end_anim_restore_gl; @@ -496,7 +496,7 @@ int32_t Anim_Play(const char *fn) rotatesprite_fs(0 << 16, 0 << 16, 65536L, 512, TILE_ANIM, 0, 0, 2 + 4 + 8 + 16 + 64 + BGSTRETCH); g_animPtr = anim; - i = VM_OnEventWithReturn(EVENT_CUTSCENE, -1, myconnectindex, i); + i = VM_OnEventWithReturn(EVENT_CUTSCENE, g_player[screenpeek].ps->i, screenpeek, i); g_animPtr = NULL; nextpage(); diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 712ba6273..45417eca6 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1247,7 +1247,7 @@ void Screen_Play(void) G_HandleAsync(); clearallviews(0); - if (VM_OnEventWithReturn(EVENT_SCREEN, -1, myconnectindex, I_CheckAllInput())) + if (VM_OnEventWithReturn(EVENT_SCREEN, g_player[screenpeek].ps->i, screenpeek, I_CheckAllInput())) running = 0; nextpage(); diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index e3f01cdfc..8ef933b32 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -3778,7 +3778,7 @@ int Menu_Change(MenuID_t cm) { Menu_t * beginMenu = m_currentMenu; - cm = VM_OnEventWithReturn(EVENT_CHANGEMENU, g_player[myconnectindex].ps->i, myconnectindex, cm); + cm = VM_OnEventWithReturn(EVENT_CHANGEMENU, g_player[screenpeek].ps->i, screenpeek, cm); if (cm == MENU_PREVIOUS) { diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index 1d1b48761..55d7c4c3a 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -610,12 +610,12 @@ static int32_t osdcmd_setvar(osdfuncparm_t const * const parm) varval = Batol(varname); i = hash_find(&h_gamevars,varname); if (i >= 0) - varval=Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex); + varval=Gv_GetVar(i, g_player[screenpeek].ps->i, screenpeek); strcpy(varname,parm->parms[0]); i = hash_find(&h_gamevars,varname); if (i >= 0) - Gv_SetVar(i, varval, g_player[myconnectindex].ps->i, myconnectindex); + Gv_SetVar(i, varval, g_player[screenpeek].ps->i, screenpeek); return OSDCMD_OK; } @@ -635,7 +635,7 @@ static int32_t osdcmd_addlogvar(osdfuncparm_t const * const parm) strcpy(varname,parm->parms[0]); i = hash_find(&h_gamevars,varname); if (i >= 0) - OSD_Printf("%s = %d\n", varname, Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex)); + OSD_Printf("%s = %d\n", varname, Gv_GetVar(i, g_player[screenpeek].ps->i, screenpeek)); return OSDCMD_OK; } @@ -664,7 +664,7 @@ static int32_t osdcmd_setactorvar(osdfuncparm_t const * const parm) varval = Batol(varname); i = hash_find(&h_gamevars,varname); if (i >= 0) - varval=Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex); + varval=Gv_GetVar(i, g_player[screenpeek].ps->i, screenpeek); strcpy(varname,parm->parms[1]); i = hash_find(&h_gamevars,varname); diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index cfaf4c305..b850b83a5 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -319,7 +319,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent) if (ud.recstat != 2) { - j = VM_OnEventWithReturn(EVENT_GETLOADTILE, -1, myconnectindex, LOADSCREEN); + j = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, LOADSCREEN); //g_player[myconnectindex].ps->palette = palette; P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 @@ -390,7 +390,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent) } /*Gv_SetVar(g_iReturnVarID,LOADSCREEN, -1, -1);*/ - j = VM_OnEventWithReturn(EVENT_GETLOADTILE, -1, myconnectindex, LOADSCREEN); + j = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, LOADSCREEN); if ((uint32_t)j < 2*MAXTILES) { @@ -1462,7 +1462,7 @@ end_vol4a: El_CreateGameState(); G_PostCreateGameState(); #endif - VM_OnEvent(EVENT_NEWGAME, g_player[myconnectindex].ps->i, myconnectindex); + VM_OnEvent(EVENT_NEWGAME, g_player[screenpeek].ps->i, screenpeek); } static void resetpspritevars(char gameMode) diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 2f455095e..703bccefb 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -263,7 +263,7 @@ int32_t G_LoadPlayer(int32_t spot) return 1; } - VM_OnEvent(EVENT_PRELOADGAME, g_player[myconnectindex].ps->i, myconnectindex); + VM_OnEvent(EVENT_PRELOADGAME, g_player[screenpeek].ps->i, screenpeek); // some setup first ud.multimode = h.numplayers; @@ -332,7 +332,7 @@ int32_t G_LoadPlayer(int32_t spot) } sv_postudload(); // ud.m_XXX = ud.XXX - VM_OnEvent(EVENT_LOADGAME, g_player[myconnectindex].ps->i, myconnectindex); + VM_OnEvent(EVENT_LOADGAME, g_player[screenpeek].ps->i, screenpeek); return 0; } @@ -438,7 +438,7 @@ int32_t G_SavePlayer(int32_t spot) polymer_resetlights(); #endif - VM_OnEvent(EVENT_SAVEGAME, g_player[myconnectindex].ps->i, myconnectindex); + VM_OnEvent(EVENT_SAVEGAME, g_player[screenpeek].ps->i, screenpeek); // SAVE! sv_saveandmakesnapshot(fil, spot, 0, 0, 0); @@ -462,7 +462,7 @@ int32_t G_SavePlayer(int32_t spot) G_RestoreTimers(); ototalclock = totalclock; - VM_OnEvent(EVENT_POSTSAVEGAME, g_player[myconnectindex].ps->i, myconnectindex); + VM_OnEvent(EVENT_POSTSAVEGAME, g_player[screenpeek].ps->i, screenpeek); return 0; } diff --git a/source/duke3d/src/sbar.cpp b/source/duke3d/src/sbar.cpp index 65114a73a..a330104e1 100644 --- a/source/duke3d/src/sbar.cpp +++ b/source/duke3d/src/sbar.cpp @@ -1037,7 +1037,7 @@ void G_DrawBackground(void) // when not rendering a game, fullscreen wipe // Gv_SetVar(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1); - bgtile = VM_OnEventWithReturn(EVENT_GETMENUTILE, -1, myconnectindex, bgtile); + bgtile = VM_OnEventWithReturn(EVENT_GETMENUTILE, g_player[screenpeek].ps->i, screenpeek, bgtile); // MENU_TILE: is the menu tile tileable? #if !defined LUNATIC if (Gv_GetVarByLabel("MENU_TILE", !fstilep, -1, -1)) diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index b1cd0ca9b..be69f7993 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -1198,7 +1198,7 @@ void G_DisplayRest(int32_t smoothratio) G_PrintFPS(); // JBF 20040124: display level stats in screen corner - if (ud.overhead_on != 2 && ud.levelstats && VM_OnEvent(EVENT_DISPLAYLEVELSTATS, g_player[myconnectindex].ps->i, myconnectindex) == 0) + if (ud.overhead_on != 2 && ud.levelstats && VM_OnEvent(EVENT_DISPLAYLEVELSTATS, g_player[screenpeek].ps->i, screenpeek) == 0) { DukePlayer_t const * const myps = g_player[myconnectindex].ps; @@ -1629,7 +1629,7 @@ void G_DisplayLogo(void) #ifdef LUNATIC g_elEventError = 0; #endif - VM_OnEvent(EVENT_LOGO, -1, screenpeek); + VM_OnEvent(EVENT_LOGO, g_player[screenpeek].ps->i, screenpeek); if (g_restorePalette) { diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index 28f30a91d..3dfd94d23 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -181,7 +181,7 @@ void S_MenuSound(void) PISTOL_RICOCHET, PISTOL_BODYHIT, PISTOL_FIRE, SHOTGUN_FIRE, BOS1_WALK, RPG_EXPLODE, PIPEBOMB_BOUNCE, PIPEBOMB_EXPLODE, NITEVISION_ONOFF, RPG_SHOOT, SELECT_WEAPON, }; - int32_t s = VM_OnEventWithReturn(EVENT_OPENMENUSOUND, -1, myconnectindex, menusnds[SoundNum++ % ARRAY_SIZE(menusnds)]); + int32_t s = VM_OnEventWithReturn(EVENT_OPENMENUSOUND, g_player[screenpeek].ps->i, screenpeek, menusnds[SoundNum++ % ARRAY_SIZE(menusnds)]); if (s != -1) S_PlaySound(s); }