ICB: Fixed several compiler warnings

This commit is contained in:
Paweł Kołodziejski 2021-03-08 10:00:06 +01:00
parent ba2a57af8f
commit ed4ae57063
14 changed files with 14 additions and 59 deletions

View File

@ -138,9 +138,6 @@ scriptInterpreterReturnCodes RunScript(const char *&scriptData, // A pointer to
int32 parameter1, parameter2, value;
bool8 isInExpression = FALSE8;
// Reset the fn routine control return value
int32 fn_routines_control_return_flag = (-1);
// Variable to prevent infinite loops
uint32 infiniteLoopCounter = 0;
@ -265,7 +262,6 @@ scriptInterpreterReturnCodes RunScript(const char *&scriptData, // A pointer to
// Push the fn_routine return value
PushOnStack(routineReturnParameter);
// save the mcode return value
fn_routines_control_return_flag = mcodeRetVal;
} else {
// Check return value in case we want to pause the script

View File

@ -32,8 +32,6 @@
namespace ICB {
#define SLEN_CHECK (slen < 0)
const char *pxString::operator=(const char *str) {
// Assign a value
@ -236,7 +234,7 @@ const pxString &pxString::Format(const char *format, ...) {
uint32 slen;
// Keep doubling the size of the buffer until it fits
while (va_start(arglist, format), slen = vsnprintf(s, startBufferSize, const_cast<char *>(format), arglist), SLEN_CHECK) {
while (va_start(arglist, format), slen = vsnprintf(s, startBufferSize, const_cast<char *>(format), arglist)) {
delete[] s;
startBufferSize += startBufferSize;

View File

@ -108,7 +108,7 @@ public:
~pxFlexiCharBuffer();
char &operator[](uint); // Allow array access
void CheckSize(uint); // Make sure we have enough room
void CheckSize(uint32); // Make sure we have enough room
char *GetBuffer() {
return (m_buffer); // Make it a little more difficult to pass the pointer
}

View File

@ -307,10 +307,6 @@ void JpegDecoder::ReadImage(uint8 *inputData, uint32 surface_Id) {
eoi_found = false;
sof_found = false;
_bit_count = 0;
_buf_pointer = (uint32 *)input_buffer;
_end_buf = (uint32 *)(input_buffer + (1024 * 1024)); // blantantly wrong... need to make cash sized buffer
data = ReadByte();
while (!eoi_found) {
if (data == SOB) {

View File

@ -34,10 +34,6 @@ namespace ICB {
class _surface;
static uint32 _bit_count;
static uint32 *_buf_pointer;
static uint32 *_end_buf;
const int32 JpegMaxHuffmanTables = 4;
const int32 MaxQuantizationTables = 4;
const int32 JpegMaxComponentsPerFrame = 255;

View File

@ -70,17 +70,6 @@ void Credits() {
}
void InitisliaseScrollingText(const char *textFileName, const char *movieFileName, int32 frameStart) {
// Movies are streamed from the CD
char *_root;
#if 1 // was ifdef FROM_PC_CD
#ifndef PC_DEMO
_root = g_theClusterManager->GetCDRoot();
#endif
#endif
// Find movie to play
pxString fullMovieName;

View File

@ -39,7 +39,7 @@
namespace ICB {
int32 LoadMission(int32 m, void *usr) {
int32 LoadMission(int32 m, void * /*usr*/) {
int32 demo = g_globalScriptVariables.GetVariable("demo");
Init_globals(); // reload the global vars for the new mission
g_globalScriptVariables.SetVariable("missionelapsedtime", 0);
@ -60,9 +60,6 @@ int32 LoadMission(int32 m, void *usr) {
rs_anims->Res_purge_all();
rs_bg->Res_purge_all();
// To remove compiler warning
usr = NULL;
warning("rs_anims %d files %dKB rs_bg %d files %dKB", rs_anims->Fetch_files_open(), (rs_anims->Fetch_mem_used() / 1024), rs_bg->Fetch_files_open(),
(rs_bg->Fetch_mem_used() / 1024));

View File

@ -187,7 +187,7 @@ uint32 MovieManager::drawFrame(uint32 surface_id) {
uint32 height = surface_manager->Get_height(surface_id);
for (int32 i = 0; i < surface->h; i++) {
if (i + _y >= height) {
if (i + _y >= (int32)height) {
break;
}
memcpy(surface_address + (i + _y) * pitch, surface->getBasePtr(0, i), MIN(surface->pitch, pitch));

View File

@ -255,16 +255,6 @@ void _remora::ActivateRemora(RemoraMode eMode) {
}
void _remora::DoPlatformSpecificInitialisation() {
uint32 nFileNameHash, nClusterHash;
char pcFileName[ENGINE_STRING_LEN];
// Load the Map Data. When clustered the session files have the base stripped.
strcpy(pcFileName, REMORA_MAP_FILENAME);
nClusterHash = MS->Fetch_session_cluster_hash();
nFileNameHash = NULL_HASH;
// Allocate a text buffer if one hasn't been allocated already.
if (!m_pDisplayBuffer)
m_pDisplayBuffer = new _remora_line[REMORA_TEXT_BUFFER_ROWS];
@ -1372,11 +1362,6 @@ void _remora::ColourToRGB(uint8 nAttributes, uint8 &nRed, uint8 &nGreen, uint8 &
}
void _remora::SetUpM08LockControl() {
uint32 oBitmapNameHash;
// We need the size of the scan screen for clipping the barriers.
oBitmapNameHash = NULL_HASH;
// Here we build a list of the door names and what object ID they are.
BuildM08DoorList();
}

View File

@ -34,7 +34,6 @@ namespace ICB {
void _remora_sprite::GenericSpriteDraw(int32 nX, int32 nY, bool8 bPosition, const _rs_params *pParams) {
_pxBitmap *psBitmap;
_pxSprite *psSprite;
uint8 *pSurfaceBitmap;
uint32 nPitch;
uint32 nSurfaceWidth, nSurfaceHeight;
@ -64,8 +63,6 @@ void _remora_sprite::GenericSpriteDraw(int32 nX, int32 nY, bool8 bPosition, cons
if (psBitmap->schema != PC_BITMAP_SCHEMA)
Fatal_error("Incorrect versions loading [%s] (engine has %d, data has %d", m_pcName, PC_BITMAP_SCHEMA, psBitmap->schema);
psSprite = psBitmap->Fetch_item_by_number(m_nFramePC);
// Lock the surface and get the pitch.
uint32 remoraSurfaceId = g_oRemora->GetRemoraSurfaceId();
pSurfaceBitmap = surface_manager->Lock_surface(remoraSurfaceId);

View File

@ -1209,16 +1209,16 @@ _linked_data_file *LoadTranslatedFile(const char *mission, const char *session)
uint32 len = stream->size();
// make space for file
char *mem = new char[len + 1];
char *memPtr = new char[len + 1];
// read it in
stream->read(mem, len);
stream->read(memPtr, len);
delete stream; // close the file
// 0 terminate the string
mem[len] = 0;
memPtr[len] = 0;
return ((_linked_data_file *)mem);
return ((_linked_data_file *)memPtr);
}
} // End of namespace ICB

View File

@ -144,7 +144,7 @@ mcodeFunctionReturnCodes _game_session::fn_request_speech(int32 &result, int32 *
// conversation script doesnt exist
if (!S.script_pc)
Fatal_error("object [%d] tried to start conversation script [%s] which doesnt exist", cur_id, (const char *const)temp_buf);
Fatal_error("object [%d] tried to start conversation script [%s] which doesnt exist", cur_id, (const char *)temp_buf);
// reset number of subs
S.total_subscribers = 0; // everyone but us initially

View File

@ -58,6 +58,7 @@ _TSrtn text_sprite::GetRenderCoords(const int32 pinX, // screen x-coor
case PIN_AT_CENTRE:
renderX = pinX - spriteWidth / 2;
renderY = pinY - spriteHeight / 2;
break;
case PIN_AT_CENTRE_OF_TOP:
renderX = pinX - spriteWidth / 2;

View File

@ -43,7 +43,7 @@ bool8 _tracer::Trace(const px3DRealPoint &oFrom, // IN: Point to plot from
const px3DRealPoint &oTo, // IN: Point to plot to.
_barrier_ray_type eRayType, // IN: The type of the ray being plotted.
px3DRealPoint &oPointOfImpact, // OUT: The first point of impact.
_barrier_logic_value eImpactType // OUT: For interpretation by high-level logic.
_barrier_logic_value /*eImpactType*/ // OUT: For interpretation by high-level logic.
) {
uint32 i;
uint32 nLoopCount;
@ -98,7 +98,7 @@ bool8 _tracer::Trace(const px3DRealPoint &oFrom, // IN: Point to plot from
if (!GetCubeAndIndices(oCurrentPoint, oThisIndex, oThisCube)) {
// We have gone outside the game world, so we can't have hit anything.
oPointOfImpact = oCurrentPoint;
eImpactType = BLOCKS;
//eImpactType = BLOCKS;
return (FALSE8);
}
@ -186,7 +186,7 @@ bool8 _tracer::Trace(const px3DRealPoint &oFrom, // IN: Point to plot from
((int32)oCurrentPoint.GetZ() >= (int32)psFloor->rect.z1) && ((int32)oCurrentPoint.GetZ() <= (int32)psFloor->rect.z2)) {
// The ray has hit a floor rectangle.
oPointOfImpact = oCurrentPoint;
eImpactType = BLOCKS;
//eImpactType = BLOCKS;
return (FALSE8);
}
} // end if
@ -203,7 +203,7 @@ bool8 _tracer::Trace(const px3DRealPoint &oFrom, // IN: Point to plot from
// In final release, we'll let this go back, but it may have the wrong answer. The effects of
// this should be benign enough to allow this.
oPointOfImpact = oTo;
eImpactType = NO_IMPACT;
//eImpactType = NO_IMPACT;
return (FALSE8);
}
} // end while