bool NETlogEntry(const char *str,UDWORD a,UDWORD b) { static const char star_line[] = "************************************************************\n"; static UDWORD lastframe = 0; UDWORD frame= frameGetFrameNumber(); time_t aclock; struct tm *newtime; char buf[256]; if (!pFileHandle) { return false; } time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct */ if (!newtime || !str || !pFileHandle) { debug(LOG_ERROR, "Fatal error averted in NETlog"); return false; } // check to see if a new frame. if(frame != lastframe) { static const char dash_line[] = "-----------------------------------------------------------\n"; lastframe = frame; PHYSFS_write(pFileHandle, dash_line, strlen(dash_line), 1); } if (a < NUM_GAME_PACKETS) // replace common msgs with txt descriptions snprintf(buf, sizeof(buf), "%s \t: %s \t:%d\t\t%s", str, messageTypeToString(a), b, asctime(newtime)); else if (a == SYNC_FLAG) snprintf(buf, sizeof(buf), "%s \t: %d \t(Sync) \t%s", str, b, asctime(newtime)); else snprintf(buf, sizeof(buf), "%s \t:%d \t\t\t:%d\t\t%s", str, a, b, asctime(newtime)); if (a == NET_PLAYER_LEAVING || a == NET_PLAYER_DROPPED ) { // Write a starry line above NET_LEAVING messages PHYSFS_write(pFileHandle, star_line, strlen(star_line), 1); PHYSFS_write(pFileHandle, buf, strlen( buf ), 1); PHYSFS_write(pFileHandle, star_line, strlen(star_line), 1); } else { PHYSFS_write(pFileHandle, buf, strlen( buf ), 1); } PHYSFS_flush(pFileHandle); return true; }
BOOL NETlogEntry(CHAR *str,UDWORD a,UDWORD b) { #ifdef LOG static UDWORD lastframe = 0; UDWORD frame= frameGetFrameNumber(); time_t aclock; struct tm *newtime; #ifndef MASSIVELOGS if(a ==9 || a==10) { return TRUE; } #endif time( &aclock ); /* Get time in seconds */ newtime = localtime( &aclock ); /* Convert time to struct */ // check to see if a new frame. if(frame != lastframe) { lastframe = frame; fprintf(pFileHandle,"-----------------------------------------------------------\n"); } switch(a) // replace common msgs with txt descriptions { case 1: fprintf(pFileHandle,"%s \t: NET_DROIDINFO \t:%d\t\t%s",str,b,asctime( newtime )); break; case 2: fprintf(pFileHandle,"%s \t: NET_DROIDDEST \t:%d\t\t%s",str,b,asctime( newtime )); break; case 3: fprintf(pFileHandle,"%s \t: NET_DROIDMOVE \t:%d\t\t%s",str,b,asctime( newtime )); break; case 4: fprintf(pFileHandle,"%s \t: NET_GROUPORDER \t:%d\t\t%s",str,b,asctime( newtime )); break; case 8: fprintf(pFileHandle,"%s \t: NET_PING \t:%d\t\t%s",str,b,asctime( newtime )); break; case 9: fprintf(pFileHandle,"%s \t: NET_CHECK_DROID \t:%d\t\t%s",str,b,asctime( newtime )); break; case 10: fprintf(pFileHandle,"%s \t: NET_CHECK_STRUCT \t:%d\t\t%s",str,b,asctime( newtime )); break; case 11: fprintf(pFileHandle,"%s \t: NET_CHECK_POWER \t:%d\t\t%s",str,b,asctime( newtime )); break; case 13: fprintf(pFileHandle,"%s \t: NET_BUILD \t:%d\t\t%s",str,b,asctime( newtime )); break; case 15: fprintf(pFileHandle,"%s \t: NET_BUILDFINISHED \t:%d\t\t%s",str,b,asctime( newtime )); break; case 17: fprintf(pFileHandle,"%s \t: NET_TXTMSG \t:%d\t\t%s",str,b,asctime( newtime )); break; case 18: fprintf(pFileHandle,"%s \t: NET_LEAVING \t:%d\t\t%s",str,b,asctime( newtime )); fprintf(pFileHandle,"************************************************************\n"); fprintf(pFileHandle,"************************************************************\n"); break; case 19: fprintf(pFileHandle,"%s \t: NET_REQUESTDROID \t:%d\t\t%s",str,b,asctime( newtime )); break; case 23: fprintf(pFileHandle,"%s \t: NET_WHOLEDROID \t:%d\t\t%s",str,b,asctime( newtime )); break; case 22: fprintf(pFileHandle,"%s \t: NET_STRUCT (Whole) \t:%d\t\t%s",str,b,asctime( newtime )); break; case 25: fprintf(pFileHandle,"%s \t: NET_PLAYERRESPONDING \t:%d\t\t%s",str,b,asctime( newtime )); break; case 26: fprintf(pFileHandle,"%s \t: NET_OPTIONS \t:%d\t\t%s",str,b,asctime( newtime )); break; case 27: fprintf(pFileHandle,"%s \t: NET_WAYPOINT \t:%d\t\t%s",str,b,asctime( newtime )); break; case 28: fprintf(pFileHandle,"%s \t: NET_SECONDARY \t:%d\t\t%s",str,b,asctime( newtime )); break; case 29: fprintf(pFileHandle,"%s \t: NET_FIREUP \t:%d\t\t%s",str,b,asctime( newtime )); break; case 34: fprintf(pFileHandle,"%s \t: NET_ARTIFACTS \t:%d\t\t%s",str,b,asctime( newtime )); break; case 36: fprintf(pFileHandle,"%s \t: NET_SCORESUBMIT \t:%d\t\t%s",str,b,asctime( newtime )); break; case 37: fprintf(pFileHandle,"%s \t: NET_DESTROYXTRA \t:%d\t\t%s",str,b,asctime( newtime )); break; case 38: fprintf(pFileHandle,"%s \t: NET_VTOL \t:%d\t\t%s",str,b,asctime( newtime )); break; case 39: fprintf(pFileHandle,"%s \t: NET_VTOLREARM \t:%d\t\t%s",str,b,asctime( newtime )); break; default: fprintf(pFileHandle,"%s \t:%d \t\t\t:%d\t\t%s",str,a,b,asctime( newtime )); break; } fflush(pFileHandle); #endif return TRUE; }
// multiple turrets display removed the pointless mountRotation void displayComponentObject(DROID *psDroid, const glm::mat4 &viewMatrix) { Vector3i position, rotation; Spacetime st = interpolateObjectSpacetime(psDroid, graphicsTime); leftFirst = angleDelta(player.r.y - st.rot.direction) <= 0; /* Get the real position */ position.x = st.pos.x - player.p.x; position.z = -(st.pos.y - player.p.z); position.y = st.pos.z; if (isTransporter(psDroid)) { position.y += bobTransporterHeight(); } /* Get all the pitch,roll,yaw info */ rotation.y = -st.rot.direction; rotation.x = st.rot.pitch; rotation.z = st.rot.roll; /* Translate origin */ /* Rotate for droid */ glm::mat4 modelMatrix = glm::translate(glm::vec3(position)) * glm::rotate(UNDEG(rotation.y), glm::vec3(0.f, 1.f, 0.f)) * glm::rotate(UNDEG(rotation.x), glm::vec3(1.f, 0.f, 0.f)) * glm::rotate(UNDEG(rotation.z), glm::vec3(0.f, 0.f, 1.f)); if (graphicsTime - psDroid->timeLastHit < GAME_TICKS_PER_SEC && psDroid->lastHitWeapon == WSC_ELECTRONIC) { modelMatrix *= objectShimmy((BASE_OBJECT *) psDroid); } // now check if the projected circle is within the screen boundaries if(!clipDroidOnScreen(psDroid, viewMatrix * modelMatrix)) { return; } if (psDroid->lastHitWeapon == WSC_EMP && graphicsTime - psDroid->timeLastHit < EMP_DISABLE_TIME) { Vector3i position; //add an effect on the droid position.x = st.pos.x + DROID_EMP_SPREAD; position.y = st.pos.z + rand() % 8; position.z = st.pos.y + DROID_EMP_SPREAD; effectGiveAuxVar(90 + rand() % 20); addEffect(&position, EFFECT_EXPLOSION, EXPLOSION_TYPE_PLASMA, false, nullptr, 0); } if (psDroid->visible[selectedPlayer] == UBYTE_MAX) { //ingame not button object //should render 3 mounted weapons now if (displayCompObj(psDroid, false, viewMatrix * modelMatrix)) { // did draw something to the screen - update the framenumber psDroid->sDisplay.frameNumber = frameGetFrameNumber(); } } else { int frame = graphicsTime / BLIP_ANIM_DURATION + psDroid->id % 8192; // de-sync the blip effect, but don't overflow the int if (pie_Draw3DShape(getImdFromIndex(MI_BLIP), frame, 0, WZCOL_WHITE, pie_ADDITIVE, psDroid->visible[selectedPlayer] / 2, viewMatrix * modelMatrix)) { psDroid->sDisplay.frameNumber = frameGetFrameNumber(); } } }