Convert manage to use new logging facility

This commit is contained in:
Azamat H. Hackimov 2024-08-20 02:34:02 +03:00
parent dc82d2314d
commit 4259fe4c18
11 changed files with 169 additions and 217 deletions

View File

@ -30,4 +30,5 @@ target_link_libraries(manage PRIVATE
model
sndlib
stream_audio
plog::plog
)

View File

@ -147,17 +147,16 @@
#include <cstring>
#include <filesystem>
#include "args.h"
#include "cfile.h"
#include "manage.h"
#include "door.h"
#include "doorpage.h"
#include "mono.h"
#include "pserror.h"
#include "log.h"
#include "manage.h"
#include "polymodel.h"
#include "ddio.h"
#include "pserror.h"
#include "soundload.h"
#include "soundpage.h"
#include "args.h"
// doorpage commands that are read/written
// A command is followed by a byte count describing how many bytes
@ -397,7 +396,7 @@ int mng_FindSpecificDoorPage(char *name, mngs_door_page *doorpage, int offset) {
}
if (!infile) {
mprintf(0, "Couldn't open table file to find door!\n");
LOG_ERROR << "Couldn't open table file to find door!";
Int3();
return 0;
}
@ -479,7 +478,7 @@ int mng_AssignDoorPageToDoor(mngs_door_page *doorpage, int n) {
doorpointer->close_sound = mng_GetGuaranteedSoundPage(doorpage->close_sound_name);
if (img_handle < 0) {
mprintf(0, "Couldn't load file '%s' in AssignDoorPage...\n", doorpage->image_name);
LOG_ERROR.printf("Couldn't load file '%s' in AssignDoorPage...", doorpage->image_name);
doorpointer->model_handle = -1;
return 0;
} else
@ -525,7 +524,7 @@ void mng_LoadNetDoorPage(CFILE *infile, bool overlay) {
n = FindDoorName(doorpage.door_struct.name);
if (n != -1) {
if (overlay) {
mprintf(0, "OVERLAYING DOOR %s\n", doorpage.door_struct.name);
LOG_DEBUG.printf("OVERLAYING DOOR %s\n", doorpage.door_struct.name);
mng_FreePagetypePrimitives(PAGETYPE_DOOR, doorpage.door_struct.name, 0);
mng_AssignDoorPageToDoor(&doorpage, n);
}
@ -535,7 +534,7 @@ void mng_LoadNetDoorPage(CFILE *infile, bool overlay) {
int ret = mng_SetAndLoadDoor(&doorpage);
ASSERT(ret >= 0);
} else
mprintf(0, "Could not load doorpage named %s!\n", doorpage.door_struct.name);
LOG_ERROR.printf("Could not load doorpage named %s!", doorpage.door_struct.name);
}
// Reads a door page from a local table file. It then allocs a door and
@ -580,7 +579,7 @@ void mng_LoadLocalDoorPage(CFILE *infile) {
if (addon->Addon_tracklocks[tidx].pagetype == PAGETYPE_DOOR &&
!stricmp(addon->Addon_tracklocks[tidx].name, doorpage.door_struct.name)) {
// found it!!
mprintf(0, "DoorPage: %s previously loaded\n", doorpage.door_struct.name);
LOG_DEBUG.printf("DoorPage: %s previously loaded", doorpage.door_struct.name);
need_to_load_page = false;
break;
}
@ -637,7 +636,7 @@ void mng_LoadLocalDoorPage(CFILE *infile) {
if (Loading_addon_table == -1)
mng_AllocTrackLock(doorpage.door_struct.name, PAGETYPE_DOOR);
} else
mprintf(0, "Could not load doorpage named %s!\n", doorpage.door_struct.name);
} else {
LOG_ERROR.printf("Could not load doorpage named %s!", doorpage.door_struct.name);
}
}

View File

@ -19,14 +19,13 @@
#include <cstring>
#include <filesystem>
#include "args.h"
#include "cfile.h"
#include "manage.h"
#include "mono.h"
#include "pserror.h"
#include "ddio.h"
#include "gamefile.h"
#include "gamefilepage.h"
#include "args.h"
#include "log.h"
#include "manage.h"
#include "pserror.h"
// gamefilepage commands that are read/written
// A command is followed by a byte count describing how many bytes
@ -270,7 +269,7 @@ void mng_LoadNetGamefilePage(CFILE *infile, bool overlay) {
int n = FindGamefileName(gamefilepage.gamefile_struct.name);
if (n != -1) {
if (overlay) {
mprintf(0, "OVERLAYING GAMEFILE %s\n", gamefilepage.gamefile_struct.name);
LOG_DEBUG.printf("OVERLAYING GAMEFILE %s", gamefilepage.gamefile_struct.name);
mng_FreePagetypePrimitives(PAGETYPE_GAMEFILE, gamefilepage.gamefile_struct.name, 0);
mng_AssignGamefilePageToGamefile(&gamefilepage, n);
}
@ -279,8 +278,9 @@ void mng_LoadNetGamefilePage(CFILE *infile, bool overlay) {
int ret = mng_SetAndLoadGamefile(&gamefilepage);
ASSERT(ret >= 0);
} else
mprintf(0, "Could not load gamefilepage named %s!\n", gamefilepage.gamefile_struct.name);
} else {
LOG_ERROR.printf("Could not load gamefilepage named %s!", gamefilepage.gamefile_struct.name);
}
}
// Reads a gamefile page from a local table file. It then allocs a gamefile and
@ -324,7 +324,7 @@ void mng_LoadLocalGamefilePage(CFILE *infile) {
if (addon->Addon_tracklocks[tidx].pagetype == PAGETYPE_GAMEFILE &&
!stricmp(addon->Addon_tracklocks[tidx].name, gamefilepage.gamefile_struct.name)) {
// found it!!
mprintf(0, "GamefilePage: %s previously loaded\n", gamefilepage.gamefile_struct.name);
LOG_DEBUG.printf("GamefilePage: %s previously loaded", gamefilepage.gamefile_struct.name);
need_to_load_page = false;
break;
}
@ -381,6 +381,7 @@ void mng_LoadLocalGamefilePage(CFILE *infile) {
if (Loading_addon_table == -1)
mng_AllocTrackLock(gamefilepage.gamefile_struct.name, PAGETYPE_GAMEFILE);
} else
mprintf(0, "Could not load gamefilepage named %s!\n", gamefilepage.gamefile_struct.name);
} else {
LOG_ERROR.printf("Could not load gamefilepage named %s!", gamefilepage.gamefile_struct.name);
}
}

View File

@ -360,7 +360,7 @@
#include "genericpage.h"
#include "soundpage.h"
#include "weaponpage.h"
#include "mono.h"
#include "log.h"
#include "pserror.h"
#include "polymodel.h"
#include "ddio.h"
@ -1786,7 +1786,7 @@ int mng_FindSpecificGenericPage(char *name, mngs_generic_page *genericpage, int
}
if (!infile) {
mprintf(0, "Couldn't open table file to find generic!\n");
LOG_ERROR << "Couldn't open table file to find generic!";
Int3();
return 0;
}
@ -1959,7 +1959,7 @@ int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE
img_handle = LoadPolyModel(genericpage->image_name, 1);
if (img_handle < 0) {
mprintf(0, "Couldn't load file '%s' in AssignGenericPage...\n", genericpage->image_name);
LOG_ERROR.printf("Couldn't load file '%s' in AssignGenericPage...", genericpage->image_name);
objinfopointer->render_handle = -1;
return 0;
} else
@ -1969,7 +1969,7 @@ int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE
img_handle = LoadPolyModel(genericpage->med_image_name, 1);
if (img_handle < 0) {
mprintf(0, "Couldn't load file '%s' in AssignGenericPage...\n", genericpage->med_image_name);
LOG_ERROR.printf("Couldn't load file '%s' in AssignGenericPage...", genericpage->med_image_name);
objinfopointer->med_render_handle = -1;
return 0;
} else
@ -1981,7 +1981,7 @@ int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE
img_handle = LoadPolyModel(genericpage->lo_image_name, 1);
if (img_handle < 0) {
mprintf(0, "Couldn't load file '%s' in AssignGenericPage...\n", genericpage->lo_image_name);
LOG_ERROR.printf("Couldn't load file '%s' in AssignGenericPage...", genericpage->lo_image_name);
objinfopointer->lo_render_handle = -1;
return 0;
} else
@ -1995,8 +1995,8 @@ int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE
int sound_handle = mng_GetGuaranteedSoundPage(genericpage->sound_name[i]);
if (sound_handle < 0) {
mprintf(0, "Couldn't load sound file '%s' in AssignPowPage %s...\n", genericpage->sound_name[i],
genericpage->objinfo_struct.name);
LOG_WARNING.printf("Couldn't load sound file '%s' in AssignPowPage %s...", genericpage->sound_name[i],
genericpage->objinfo_struct.name);
objinfopointer->sounds[i] = SOUND_NONE_INDEX;
} else
objinfopointer->sounds[i] = sound_handle;
@ -2029,8 +2029,8 @@ int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE
int sound_handle = mng_GetGuaranteedSoundPage(genericpage->ai_sound_name[i]);
if (sound_handle < 0) {
mprintf(0, "Couldn't load ai sound file '%s' in AssignPowPage %s...\n", genericpage->ai_sound_name[i],
genericpage->objinfo_struct.name);
LOG_ERROR.printf("Couldn't load ai sound file '%s' in AssignPowPage %s...", genericpage->ai_sound_name[i],
genericpage->objinfo_struct.name);
objinfopointer->ai_info->sound[i] = SOUND_NONE_INDEX;
} else
objinfopointer->ai_info->sound[i] = sound_handle;
@ -2047,7 +2047,7 @@ int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE
int weapon_handle = mng_GetGuaranteedWeaponPage(genericpage->weapon_name[i][j]);
if (weapon_handle < 0) {
mprintf(0, "Couldn't load weapon file '%s' in AssignPowPage %s...\n", genericpage->weapon_name[i][j],
LOG_ERROR.printf("Couldn't load weapon file '%s' in AssignPowPage %s...", genericpage->weapon_name[i][j],
genericpage->objinfo_struct.name);
objinfopointer->static_wb[i].gp_weapon_index[j] = LASER_INDEX;
} else
@ -2064,8 +2064,8 @@ int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE
int fire_sound_handle = mng_GetGuaranteedSoundPage(genericpage->fire_sound_name[i][j]);
if (fire_sound_handle < 0) {
mprintf(0, "Couldn't load fire sound file '%s' in AssignPowPage %s...\n",
genericpage->fire_sound_name[i][j], genericpage->objinfo_struct.name);
LOG_ERROR.printf("Couldn't load fire sound file '%s' in AssignPowPage %s...",
genericpage->fire_sound_name[i][j], genericpage->objinfo_struct.name);
objinfopointer->static_wb[i].fm_fire_sound_index[j] = SOUND_NONE_INDEX;
} else
objinfopointer->static_wb[i].fm_fire_sound_index[j] = fire_sound_handle;
@ -2083,8 +2083,8 @@ int mng_AssignGenericPageToObjInfo(mngs_generic_page *genericpage, int n, CFILE
int anim_sound_handle = mng_GetGuaranteedSoundPage(genericpage->anim_sound_name[i][j]);
if (anim_sound_handle < 0) {
mprintf(0, "Couldn't load anim sound file '%s' in AssignPowPage %s...\n",
genericpage->anim_sound_name[i][j], genericpage->objinfo_struct.name);
LOG_ERROR.printf("Couldn't load anim sound file '%s' in AssignPowPage %s...",
genericpage->anim_sound_name[i][j], genericpage->objinfo_struct.name);
objinfopointer->anim[i].elem[j].anim_sound_index = SOUND_NONE_INDEX;
} else
objinfopointer->anim[i].elem[j].anim_sound_index = anim_sound_handle;
@ -2202,7 +2202,7 @@ void mng_LoadNetGenericPage(CFILE *infile, bool overlay) {
int n = FindObjectIDName(genericpage.objinfo_struct.name);
if (n != -1) {
if (overlay) {
mprintf(0, "OVERLAYING GENERIC %s\n", genericpage.objinfo_struct.name);
LOG_DEBUG.printf("OVERLAYING GENERIC %s", genericpage.objinfo_struct.name);
mng_FreePagetypePrimitives(PAGETYPE_GENERIC, genericpage.objinfo_struct.name, 0);
mng_AssignGenericPageToObjInfo(&genericpage, n);
}
@ -2212,7 +2212,7 @@ void mng_LoadNetGenericPage(CFILE *infile, bool overlay) {
int ret = mng_SetAndLoadGeneric(&genericpage, infile);
ASSERT(ret >= 0);
} else
mprintf(0, "Could not load genericpage named %s!\n", genericpage.objinfo_struct.name);
LOG_ERROR.printf("Could not load genericpage named %s!", genericpage.objinfo_struct.name);
}
// Reads a generic page from a local table file. It then allocs a generic and
@ -2256,7 +2256,7 @@ void mng_LoadLocalGenericPage(CFILE *infile) {
if (addon->Addon_tracklocks[tidx].pagetype == PAGETYPE_GENERIC &&
!stricmp(addon->Addon_tracklocks[tidx].name, genericpage.objinfo_struct.name)) {
// found it!!
mprintf(0, "GenericPage: %s previously loaded\n", genericpage.objinfo_struct.name);
LOG_DEBUG.printf("GenericPage: %s previously loaded", genericpage.objinfo_struct.name);
need_to_load_page = false;
break;
}
@ -2312,9 +2312,9 @@ void mng_LoadLocalGenericPage(CFILE *infile) {
if (Loading_addon_table == -1)
mng_AllocTrackLock(genericpage.objinfo_struct.name, PAGETYPE_GENERIC);
} else
mprintf(0, "Could not load genericpage named %s!\n", genericpage.objinfo_struct.name);
} else {
LOG_ERROR.printf("Could not load genericpage named %s!", genericpage.objinfo_struct.name);
}
}
// First searches through the object index to see if the object is already

View File

@ -453,7 +453,7 @@
#include "shippage.h"
#include "weaponpage.h"
#include "gamefilepage.h"
#include "mono.h"
#include "log.h"
#include "object.h"
#include "ddio.h"
#include "cfile.h"
@ -461,12 +461,12 @@
#include "genericpage.h"
#include "mem.h"
#include "dedicated_server.h"
#include "AppConsole.h"
#include "init.h"
#include "stringtable.h"
#include "args.h"
#include "vclip.h"
#include "polymodel.h"
int Old_table_method = 0;
void mng_WriteNewUnknownPage(CFILE *outfile);
// This is for levels
@ -597,7 +597,7 @@ int mng_InitTableFiles() {
#endif
}
} else {
mprintf(0, "Network is down...\n");
LOG_WARNING << "Network is down...";
Network_up = 0;
}
@ -674,7 +674,7 @@ int mng_LoadTableFiles(int show_progress) {
int mng_InitLocalTables() {
// Set the local table directory from the base directory
strcpy(LocalD3Dir, Base_directory);
mprintf(1, "Local dir:%s\n", LocalD3Dir);
LOG_INFO << "Local dir: " << LocalD3Dir;
// Make the CFILE system first look at our local directories. If the goods aren't
// found there, try out on the network
@ -729,7 +729,7 @@ int mng_InitNetTables() {
Error("D3_DIR environment variable not set.");
strcpy(NetD3Dir, dir);
mprintf(1, "Net dir:%s\n", NetD3Dir);
LOG_INFO << "Net dir: " << NetD3Dir;
// TODO: temp variable until NetD3Dir will be std::fs::path
std::filesystem::path netdir = std::filesystem::path(NetD3Dir);
@ -772,14 +772,14 @@ void mng_CheckToCreateNetTables() {
if (errno == ENOENT) {
outfile = (CFILE *)cfopen(TableFilename, "wb");
if (!outfile) {
mprintf(0, "Error creating table file! The network must be down...\n");
LOG_WARNING << "Error creating table file! The network must be down...";
Network_up = 0;
} else {
mng_WriteNewUnknownPage(outfile);
cfclose(outfile);
}
} else {
mprintf(0, "Error creating table file! The network must be down...\n");
LOG_WARNING << "Error creating table file! The network must be down...";
Network_up = 0;
}
}
@ -793,7 +793,7 @@ void mng_CheckToCreateLocalTables() {
if (!Network_up) {
strcpy(TableFilename, NET_TABLE);
mprintf(0, "table filename = %s\n", TableFilename);
LOG_DEBUG << "table filename = " << TableFilename;
return;
}
@ -885,7 +885,7 @@ void mng_BackupTableFile() {
}
if (!cfexist(str) || cf_Diff(str, TableFilename)) {
mprintf(0, "Making local copy of table file.\n");
LOG_INFO << "Making local copy of table file.";
if (!cf_CopyFile(str, TableFilename, 1))
Error("There was an error making a backup copy of the table file.\n");
@ -893,7 +893,7 @@ void mng_BackupTableFile() {
if (!cf_CopyFile(str, TableLockFilename, 1))
Error("There was an error making a backup copy of the locker table file.\n");
} else {
mprintf(0, "Local table file same as network copy.\n");
LOG_INFO << "Local table file same as network copy.";
TableTimeThreshold.dwHighDateTime = -1;
Fast_load_trick = 1;
}
@ -937,7 +937,7 @@ int mng_AllocTrackLock(char *name, int pagetype) {
strcpy(GlobalTrackLocks[i].name, name);
GlobalTrackLocks[i].pagetype = pagetype;
GlobalTrackLocks[i].used = 1;
mprintf(0, "Tracklock %s allocated.\n", name);
LOG_DEBUG.printf("Tracklock %s allocated.", name);
return i;
}
Error("Couldn't get a free tracklock!");
@ -945,7 +945,7 @@ int mng_AllocTrackLock(char *name, int pagetype) {
}
// Frees a tracklock
void mng_FreeTrackLock(int n) {
mprintf(0, "Tracklock %s freed.\n", GlobalTrackLocks[n].name);
LOG_DEBUG.printf("Tracklock %s freed.", GlobalTrackLocks[n].name);
GlobalTrackLocks[n].pagetype = PAGETYPE_UNKNOWN;
GlobalTrackLocks[n].used = 0;
GlobalTrackLocks[n].name[0] = 0;
@ -1100,7 +1100,7 @@ int mng_RenamePage(char *oldname, char *newname, int pagetype) {
mngs_Pagelock pl;
char oname[PAGENAME_LEN];
mprintf(0, "Renaming %s to %s...\n", oldname, newname);
LOG_INFO.printf("Renaming %s to %s...", oldname, newname);
strcpy(oname, oldname);
strcpy(pl.name, oname);
pl.pagetype = pagetype;
@ -1218,7 +1218,7 @@ int mng_LoadNetPages(int show_progress) {
int int_progress = 0;
int len;
mprintf(0, "Loading pages...");
LOG_INFO << "Loading pages...";
if (Dedicated_server)
show_progress = 0; // turn off progress meter for dedicated server
// If the network is up we still want to read from the local table because it
@ -1234,7 +1234,7 @@ int mng_LoadNetPages(int show_progress) {
} else
infile = cfopen(TableFilename, "rb");
if (!infile) {
mprintf(0, "Couldn't open table file (%s) to read pages!\n", TableFilename);
LOG_ERROR.printf("Couldn't open table file (%s) to read pages!\n", TableFilename);
Error("Cannot open table file <%s>", TableFilename);
return 0;
}
@ -1263,9 +1263,6 @@ int mng_LoadNetPages(int show_progress) {
len = cf_ReadInt(infile);
switch (pagetype) {
case PAGETYPE_TEXTURE:
mprintf(0, "T");
PrintDedicatedMessage("T");
mng_LoadNetTexturePage(infile);
break;
case PAGETYPE_POWERUP:
@ -1273,42 +1270,27 @@ int mng_LoadNetPages(int show_progress) {
Error("Your local table file is invalid. You must update from the network.");
break;
case PAGETYPE_DOOR:
mprintf(0, "D");
PrintDedicatedMessage("D");
mng_LoadNetDoorPage(infile);
break;
case PAGETYPE_GENERIC:
mprintf(0, "G");
PrintDedicatedMessage("G");
mng_LoadNetGenericPage(infile);
break;
case PAGETYPE_GAMEFILE:
mprintf(0, "F");
PrintDedicatedMessage("F");
mng_LoadNetGamefilePage(infile);
break;
case PAGETYPE_SOUND:
mprintf(0, "S");
PrintDedicatedMessage("S");
mng_LoadNetSoundPage(infile);
break;
case PAGETYPE_SHIP:
mprintf(0, "P");
PrintDedicatedMessage("P");
mng_LoadNetShipPage(infile);
break;
case PAGETYPE_WEAPON:
mprintf(0, "W");
PrintDedicatedMessage("W");
mng_LoadNetWeaponPage(infile);
break;
case PAGETYPE_MEGACELL:
mprintf(0, "M");
PrintDedicatedMessage("M");
mng_LoadNetMegacellPage(infile);
break;
case PAGETYPE_UNKNOWN:
mprintf(0, "?");
break;
default:
Int3(); // Unrecognized pagetype, possible corrupt data following
@ -1317,9 +1299,7 @@ int mng_LoadNetPages(int show_progress) {
}
n_pages++;
}
mprintf(0, "\n%d pages read in %.1f seconds.\n", n_pages, timer_GetTime() - start_time);
mprintf(0, "\n");
PrintDedicatedMessage((0, "\nPage reading completed.\n"));
LOG_INFO.printf("%d pages read in %.1f seconds.", n_pages, timer_GetTime() - start_time);
cfclose(infile);
@ -1330,10 +1310,7 @@ int mng_LoadNetPages(int show_progress) {
if (!infile)
return 1;
mprintf(0, "==================================================\n");
mprintf(0, " Loading extra.gam \n");
mprintf(0, "==================================================\n");
PrintDedicatedMessage("\nLoading extra.gam.....\n");
LOG_INFO << "Loading extra.gam";
n_pages = 0;
TablefileNameOverride = name_override;
@ -1343,42 +1320,27 @@ int mng_LoadNetPages(int show_progress) {
len = cf_ReadInt(infile);
switch (pagetype) {
case PAGETYPE_TEXTURE:
mprintf(0, "T");
PrintDedicatedMessage("T");
mng_LoadNetTexturePage(infile, true);
break;
case PAGETYPE_DOOR:
mprintf(0, "D");
PrintDedicatedMessage("D");
mng_LoadNetDoorPage(infile, true);
break;
case PAGETYPE_GENERIC:
mprintf(0, "G");
PrintDedicatedMessage("G");
mng_LoadNetGenericPage(infile, true);
break;
case PAGETYPE_GAMEFILE:
mprintf(0, "F");
PrintDedicatedMessage("F");
mng_LoadNetGamefilePage(infile, true);
break;
case PAGETYPE_SOUND:
mprintf(0, "S");
PrintDedicatedMessage("S");
mng_LoadNetSoundPage(infile, true);
break;
case PAGETYPE_SHIP:
mprintf(0, "P");
PrintDedicatedMessage("P");
mng_LoadNetShipPage(infile, true);
break;
case PAGETYPE_WEAPON:
mprintf(0, "W");
PrintDedicatedMessage("W");
mng_LoadNetWeaponPage(infile, true);
break;
case PAGETYPE_UNKNOWN:
mprintf(0, "?");
break;
default:
Int3(); // Unrecognized pagetype, possible corrupt data following
@ -1389,7 +1351,7 @@ int mng_LoadNetPages(int show_progress) {
}
n_pages++;
}
mprintf(0, "\n%d extra pages read.\n", n_pages);
LOG_INFO.printf("%d extra pages read.", n_pages);
TablefileNameOverride = NULL;
cfclose(infile);
return 1;
@ -1400,10 +1362,10 @@ int mng_LoadLocalPages() {
uint8_t pagetype;
int len;
mprintf(0, "Overlaying local pages...");
LOG_INFO << "Overlaying local pages...";
infile = cfopen(LocalTableFilename, "rb");
if (!infile) {
mprintf(0, "Couldn't open local table file (%s) to read pages!\n", LocalTableFilename);
LOG_WARNING.printf("Couldn't open local table file (%s) to read pages!", LocalTableFilename);
return 1;
}
Loading_locals = 1;
@ -1413,7 +1375,6 @@ int mng_LoadLocalPages() {
pagetype = cf_ReadByte(infile);
if (!Old_table_method)
len = cf_ReadInt(infile);
mprintf(0, ".");
switch (pagetype) {
case PAGETYPE_TEXTURE:
mng_LoadLocalTexturePage(infile);
@ -1451,7 +1412,6 @@ int mng_LoadLocalPages() {
break;
}
}
mprintf(0, "\n");
cfclose(infile);
Loading_locals = 0;
return 1;
@ -1496,13 +1456,13 @@ void mng_TransferPages() {
CFILE *infile, *outfile;
int pagetype;
int num_tracklocks = 0;
mprintf(0, "Transferring pages, please wait...\n");
LOG_INFO << "Transferring pages, please wait...";
if (!mng_MakeLocker())
return;
infile = cfopen(TableFilename, "rb");
if (!infile) {
mprintf(0, "Couldn't open table file to transfer!\n");
LOG_ERROR << "Couldn't open table file to transfer!";
Int3();
return;
}
@ -1597,7 +1557,7 @@ void mng_TransferPages() {
if (found != -1)
mng_WritePagelock(outfile, &temp_pl);
else {
mprintf(0, "Found unused lock file %s\n", temp_pl.name);
LOG_WARNING.printf("Found unused lock file %s", temp_pl.name);
}
} else
@ -1616,7 +1576,7 @@ void mng_TransferPages() {
goto done;
}
mng_EraseLocker();
mprintf(0, "Done transferring pages...good luck!\n");
LOG_INFO << "Done transferring pages...good luck!";
done:;
mem_free(local_tracklocks);
}
@ -1653,7 +1613,7 @@ void ReorderPages(int local) {
ReorderPagelocks();
return;
#endif
mprintf(0, "Reordering pages, please wait...\n");
LOG_INFO << "Reordering pages, please wait...";
if (local)
infile = cfopen(LocalTableFilename, "rb");
else {
@ -1662,7 +1622,7 @@ void ReorderPages(int local) {
infile = cfopen(TableFilename, "rb");
}
if (!infile) {
mprintf(0, "Couldn't open table file to reorder!\n");
LOG_ERROR << "Couldn't open table file to reorder!";
Int3();
return;
}
@ -1671,7 +1631,7 @@ void ReorderPages(int local) {
else
outfile = cfopen(TempTableFilename, "wb");
if (!outfile) {
mprintf(0, "Couldn't open temp table file to reorder!\n");
LOG_ERROR << "Couldn't open temp table file to reorder!";
cfclose(infile);
Int3();
return;
@ -1954,7 +1914,7 @@ void BuildOldFilesForDirectory(const std::filesystem::path& path, FILETIME thres
// Searches through all our netdirectories for old files
void BuildOldFileList(FILETIME threshold) {
char str[_MAX_PATH];
mprintf(0, "Building old files list!\n");
LOG_INFO << "Building old files list!";
BuildOldFilesForDirectory(NetModelsDir, threshold);
BuildOldFilesForDirectory(NetSoundsDir, threshold);
BuildOldFilesForDirectory(NetMiscDir, threshold);
@ -1968,7 +1928,7 @@ void BuildOldFileList(FILETIME threshold) {
BuildOldFilesForDirectory(str, threshold);
ddio_MakePath(str, NetD3Dir, "data", "scripts", NULL);
BuildOldFilesForDirectory(str, threshold);
mprintf(0, "Found %d old files.\n", Num_old_files);
LOG_INFO.printf("Found %d old files.", Num_old_files);
}
#endif
@ -2002,7 +1962,7 @@ void UpdatePrimitive(const std::filesystem::path &localname, const std::filesyst
temp_pl.pagetype = pagetype;
strcpy(temp_pl.name, pagename);
if (!InLockList(&temp_pl)) {
mprintf(0, "Making a local copy of %s for next time.\n", primname);
LOG_DEBUG.printf("Making a local copy of %s for next time.", primname);
if (!cf_CopyFile(localname, netname, 1)) {
Int3(); // get Jason
return;
@ -2077,14 +2037,14 @@ int mng_ReplacePage(char *srcname, char *destname, int handle, int dest_pagetype
CFILE *infile, *outfile;
uint8_t pagetype, replaced = 0;
int done = 0, len;
mprintf(0, "Replacing '%s' with '%s' (%s).\n", srcname, destname, local ? "locally" : "to network");
LOG_DEBUG.printf("Replacing '%s' with '%s' (%s).", srcname, destname, local ? "locally" : "to network");
if (local)
infile = cfopen(LocalTableFilename, "rb");
else
infile = cfopen(TableFilename, "rb");
if (!infile) {
mprintf(0, "Couldn't open table file to replace page %s!\n", srcname);
LOG_ERROR.printf("Couldn't open table file to replace page %s!", srcname);
Int3();
return 0;
}
@ -2093,7 +2053,7 @@ int mng_ReplacePage(char *srcname, char *destname, int handle, int dest_pagetype
else
outfile = cfopen(TempTableFilename, "wb");
if (!outfile) {
mprintf(0, "Couldn't open temp table file to replace page %s!\n", srcname);
LOG_ERROR.printf("Couldn't open temp table file to replace page %s!", srcname);
cfclose(infile);
Int3();
return 0;
@ -2101,7 +2061,7 @@ int mng_ReplacePage(char *srcname, char *destname, int handle, int dest_pagetype
// Allocate memory for copying
uint8_t *copybuffer = (uint8_t *)mem_malloc(COPYBUFFER_SIZE);
if (!copybuffer) {
mprintf(0, "Couldn't allocate memory to replace page %s!\n", srcname);
LOG_ERROR.printf("Couldn't allocate memory to replace page %s!", srcname);
cfclose(infile);
cfclose(outfile);
Int3();
@ -2224,9 +2184,9 @@ int mng_ReplacePage(char *srcname, char *destname, int handle, int dest_pagetype
mng_AssignAndWritePage(handle, dest_pagetype, outfile);
}
if (replaced)
mprintf(0, "Page replaced.\n");
LOG_DEBUG << "Page replaced.";
else
mprintf(0, "New page added.\n");
LOG_DEBUG << "New page added.";
cfclose(infile);
cfclose(outfile);
mem_free(copybuffer);
@ -2247,14 +2207,14 @@ int mng_DeletePage(char *name, int dest_pagetype, int local) {
int done = 0;
int deleted = 0;
mprintf(0, "Deleting %s (%s).\n", name, local ? "locally" : "on network");
LOG_DEBUG.printf("Deleting %s (%s).", name, local ? "locally" : "on network");
if (local)
infile = cfopen(LocalTableFilename, "rb");
else
infile = cfopen(TableFilename, "rb");
if (!infile) {
mprintf(0, "Couldn't open table file to delete page!\n");
LOG_ERROR << "Couldn't open table file to delete page!";
Int3();
return 0;
}
@ -2263,7 +2223,7 @@ int mng_DeletePage(char *name, int dest_pagetype, int local) {
else
outfile = cfopen(TempTableFilename, "wb");
if (!outfile) {
mprintf(0, "Couldn't open temp table file to delete page!\n");
LOG_ERROR << "Couldn't open temp table file to delete page!";
cfclose(infile);
Int3();
return 0;
@ -2271,7 +2231,7 @@ int mng_DeletePage(char *name, int dest_pagetype, int local) {
// Allocate memory for copying
uint8_t *copybuffer = (uint8_t *)mem_malloc(COPYBUFFER_SIZE);
if (!copybuffer) {
mprintf(0, "Couldn't allocate memory to delete page!\n");
LOG_ERROR << "Couldn't allocate memory to delete page!";
cfclose(infile);
cfclose(outfile);
Int3();
@ -2376,7 +2336,7 @@ int mng_DeletePage(char *name, int dest_pagetype, int local) {
ASSERT(deleted == 1);
} else {
if (!deleted) {
mprintf(0, "Not found locally?!\n");
LOG_ERROR << "Not found locally?!";
}
}
cfclose(infile);
@ -2636,7 +2596,7 @@ void mng_PopAddonPages() {
AddOnTablefile *addondata = &AddOnDataTables[Num_addon_tables];
for (i = 0; i < addondata->Num_addon_tracklocks; i++) {
mprintf(0, "Freeing addon page %s [%s].\n", addondata->Addon_tracklocks[i].name, addondata->AddOnTableFilename);
LOG_DEBUG.printf("Freeing addon page %s [%s].", addondata->Addon_tracklocks[i].name, addondata->AddOnTableFilename);
// set the Loading_addon_table to the appropriate value...
// it depends on if we are overlaying from a previous tablefile
@ -2802,7 +2762,7 @@ void mng_PushAddonPage(int pagetype, char *name, int overlay) {
}
}
}
mprintf(0, "Adding addon page %s [%s] to list.\n", name, addon->AddOnTableFilename);
LOG_DEBUG.printf("Adding addon page %s [%s] to list.", name, addon->AddOnTableFilename);
addon->Addon_tracklocks[addon->Num_addon_tracklocks].used = 1;
addon->Addon_tracklocks[addon->Num_addon_tracklocks].pagetype = pagetype;
addon->Addon_tracklocks[addon->Num_addon_tracklocks].overlay = overlay;
@ -2830,10 +2790,10 @@ void mng_CompileAddonPages(void) {
// overlay > 1 (from addontable[overlay-2]
if (curr_tablefile == 1) {
file = cfopen(TableFilename, "rb");
mprintf(0, "Compiling addon pages of %s\n", TableFilename);
LOG_DEBUG << "Compiling addon pages of " << TableFilename;
} else {
file = cfopen(AddOnDataTables[curr_tablefile - 2].AddOnTableFilename, "rb");
mprintf(0, "Compiling addon pages of %s\n", AddOnDataTables[curr_tablefile - 2].AddOnTableFilename);
LOG_DEBUG << "Compiling addon pages of " << AddOnDataTables[curr_tablefile - 2].AddOnTableFilename;
}
ASSERT(file != NULL);
@ -2900,7 +2860,7 @@ void mng_CompileAddonPages(void) {
continue;
// this is it!
mprintf(0, "***Compiling: %s[%s] to %d\n", AddOnDataTables[tf].Addon_tracklocks[i].name,
LOG_INFO.printf("Compiling: %s[%s] to %d", AddOnDataTables[tf].Addon_tracklocks[i].name,
(curr_tablefile == 1) ? TableFilename : AddOnDataTables[curr_tablefile - 2].AddOnTableFilename,
page_pos);
ASSERT(AddOnDataTables[tf].Addon_tracklocks[i].stack_filepos == 0);
@ -2949,11 +2909,11 @@ void mng_LoadAddonPages() {
for (c = 0; c < Num_addon_tables; c++) {
addon = &AddOnDataTables[c];
mprintf(0, "------------------------------------\nLoading addon pages for %s....\n", addon->AddOnTableFilename);
LOG_INFO.printf("Loading addon pages for %s...", addon->AddOnTableFilename);
Addon_filename = addon->AddOnTableFilename;
infile = cfopen(addon->AddOnTableFilename, "rb");
if (!infile) {
mprintf(0, "Couldn't addon table file (%s) to read pages!\n", addon->AddOnTableFilename);
LOG_ERROR.printf("Couldn't addon table file (%s) to read pages!\n", addon->AddOnTableFilename);
return;
}
Loading_addon_table = c;
@ -2962,7 +2922,6 @@ void mng_LoadAddonPages() {
pagetype = cf_ReadByte(infile);
len = cf_ReadInt(infile);
mprintf(0, ".");
switch (pagetype) {
case PAGETYPE_TEXTURE:
mng_LoadLocalTexturePage(infile);
@ -2999,7 +2958,6 @@ void mng_LoadAddonPages() {
break;
}
}
mprintf(0, "------------------------------------\n");
cfclose(infile);
}

View File

@ -62,15 +62,15 @@
*/
#include <cstring>
#include "cfile.h"
#include "manage.h"
#include "megacell.h"
#include "megapage.h"
#include "texpage.h"
#include "mono.h"
#include "log.h"
#include "pserror.h"
#include "polymodel.h"
#include "ddio.h"
// megacellpage commands that are read/written
// A command is followed by a byte count describing how many bytes
// are in the data for the command
@ -202,7 +202,7 @@ int mng_FindSpecificMegacellPage(char *name, mngs_megacell_page *megacellpage, i
else
infile = cfopen(TableFilename, "rb");
if (!infile) {
mprintf(0, "Couldn't open table file to find megacell!\n");
LOG_ERROR << "Couldn't open table file to find megacell!";
Int3();
return 0;
}
@ -294,7 +294,7 @@ void mng_LoadNetMegacellPage(CFILE *infile) {
int ret = mng_SetAndLoadMegacell(&megacellpage);
ASSERT(ret >= 0);
} else
mprintf(0, "Could not load megacellpage named %s!\n", megacellpage.megacell_struct.name);
LOG_ERROR.printf("Could not load megacellpage named %s!", megacellpage.megacell_struct.name);
}
// Reads a megacell page from a local table file. It then allocs a megacell and
// loads any images/models associated with that megacell
@ -334,5 +334,5 @@ void mng_LoadLocalMegacellPage(CFILE *infile) {
if (Loading_addon_table == -1)
mng_AllocTrackLock(megacellpage.megacell_struct.name, PAGETYPE_MEGACELL);
} else
mprintf(0, "Could not load megacellpage named %s!\n", megacellpage.megacell_struct.name);
LOG_ERROR.printf("Could not load megacellpage named %s!", megacellpage.megacell_struct.name);
}

View File

@ -185,7 +185,7 @@
#include "manage.h"
#include "pstypes.h"
#include "pserror.h"
#include "mono.h"
#include "log.h"
#include "mem.h"
#ifndef RELEASE
@ -236,7 +236,7 @@ char *mng_CheckIfLockerPresent() {
cf_ReadString(lockname, sizeof(lockname), infile);
mprintf(0, "%s has already got exlusive access to the table file.\n", lockname);
LOG_WARNING.printf("%s has already got exclusive access to the table file.", lockname);
cfclose(infile);
@ -252,7 +252,7 @@ int TableVersionCurrent() {
infile = (CFILE *)cfopen(VersionFile, "rb");
if (!infile) {
mprintf(0, "Couldn't open the version file for querying!\n");
LOG_ERROR << "Couldn't open the version file for querying!";
return 0;
}
@ -302,7 +302,7 @@ int mng_MakeLocker() {
outfile = (CFILE *)cfopen(LockerFile, "wb");
if (!outfile) {
OutrageMessageBox("Error opening the locker file!");
mprintf(0, "couldn't open the locker file!\n");
LOG_ERROR << "Couldn't open the locker file!";
return 0;
}
#endif
@ -472,7 +472,7 @@ int mng_ReadPagelock(CFILE *fp, mngs_Pagelock *pl) {
pl->holder[PAGELOCK_NAME_LEN] = 0;
if (pl->pagetype == PAGETYPE_POWERUP) {
mprintf(0, "Powerup lock: %d, %s, %s\n", pl->pagetype, pl->name, pl->holder);
LOG_DEBUG.printf("Powerup lock: %d, %s, %s", pl->pagetype, pl->name, pl->holder);
}
return 1;
@ -556,7 +556,7 @@ int mng_DeletePagelock(char *name, int pagetype) {
int done = 0, deleted = 0;
mngs_Pagelock temp_pl;
mprintf(0, "Deleting pagelock %s.\n", name);
LOG_DEBUG.printf("Deleting pagelock %s.", name);
infile = (CFILE *)cfopen(TableLockFilename, "rb");
if (!infile) {
@ -631,7 +631,7 @@ int mng_DeletePagelockSeries(char *names[], int num, int pagetype) {
if (found == -1)
mng_WritePagelock(outfile, &temp_pl);
else
mprintf(0, "Deleting pagelock %s.\n", names[found]);
LOG_DEBUG.printf("Deleting pagelock %s.", names[found]);
} else
mng_WritePagelock(outfile, &temp_pl);
@ -682,7 +682,7 @@ int mng_DeleteDuplicatePagelocks() {
int found = -1;
for (i = 0; i < num; i++) {
if (temp_pl.pagetype == already_read[i].pagetype && !stricmp(temp_pl.name, already_read[i].name)) {
mprintf(0, "Found duplicated %s\n", temp_pl.name);
LOG_DEBUG.printf("Found duplicated %s", temp_pl.name);
found = i;
duplicates++;
}
@ -701,7 +701,7 @@ int mng_DeleteDuplicatePagelocks() {
}
cfclose(infile);
mprintf(0, "Found %d duplicates!\n", duplicates);
LOG_DEBUG.printf("Found %d duplicates!", duplicates);
/* cfclose (outfile);
if (remove (TableLockFilename))
@ -757,9 +757,9 @@ int mng_UnlockPagelockSeries(const char *names[], int *pagetypes, int num) {
else {
if (pagetypes[found] == temp_pl.pagetype) {
if (already_done[found]) {
mprintf(0, "Found duplicate=%s\n", names[found]);
LOG_DEBUG.printf("Found duplicate=%s", names[found]);
} else {
mprintf(0, "Replacing pagelock %s to UNLOCKED.\n", names[found]);
LOG_DEBUG.printf("Replacing pagelock %s to UNLOCKED.", names[found]);
strcpy(temp_pl.holder, "UNLOCKED");
mng_WritePagelock(outfile, &temp_pl);
total++;
@ -776,7 +776,7 @@ int mng_UnlockPagelockSeries(const char *names[], int *pagetypes, int num) {
cfclose(infile);
cfclose(outfile);
mprintf(0, "Unlocked %d pages\n", total);
LOG_DEBUG.printf("Unlocked %d pages\n", total);
if (remove(TableLockFilename)) {
snprintf(ErrorString, sizeof(ErrorString), "There was a problem deleting the temp file - errno %d", errno);

View File

@ -205,11 +205,9 @@
#include "manage.h"
#include "ship.h"
#include "shippage.h"
#include "mono.h"
#include "log.h"
#include "pserror.h"
#include "polymodel.h"
#include "ddio.h"
#include "robotfire.h"
#include "weaponpage.h"
#include "soundload.h"
#include "sounds.h"
@ -868,7 +866,7 @@ int mng_FindSpecificShipPage(char *name, mngs_ship_page *shippage, int offset) {
}
if (!infile) {
mprintf(0, "Couldn't open table file to find ship!\n");
LOG_ERROR << "Couldn't open table file to find ship!";
Int3();
return 0;
}
@ -971,7 +969,7 @@ int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile) {
img_handle = LoadPolyModel(shippage->image_name, 1);
if (img_handle < 0) {
mprintf(0, "Couldn't load file '%s' in AssignShipPage...\n", shippage->image_name);
LOG_ERROR.printf("Couldn't load file '%s' in AssignShipPage...", shippage->image_name);
shippointer->model_handle = -1;
return 0;
} else
@ -981,7 +979,7 @@ int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile) {
img_handle = LoadPolyModel(shippage->dying_image_name, 1);
if (img_handle < 0) {
mprintf(0, "Couldn't load file '%s' in AssignShipPage...\n", shippage->dying_image_name);
LOG_ERROR.printf("Couldn't load file '%s' in AssignShipPage...", shippage->dying_image_name);
shippointer->dying_model_handle = -1;
return 0;
} else
@ -994,7 +992,7 @@ int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile) {
img_handle = LoadPolyModel(shippage->med_image_name, 1);
if (img_handle < 0) {
mprintf(0, "Couldn't load file '%s' in AssignShipPage...\n", shippage->med_image_name);
LOG_ERROR.printf("Couldn't load file '%s' in AssignShipPage...", shippage->med_image_name);
shippointer->med_render_handle = -1;
return 0;
} else
@ -1006,7 +1004,7 @@ int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile) {
img_handle = LoadPolyModel(shippage->lo_image_name, 1);
if (img_handle < 0) {
mprintf(0, "Couldn't load file '%s' in AssignGenericPage...\n", shippage->lo_image_name);
LOG_ERROR.printf("Couldn't load file '%s' in AssignGenericPage...", shippage->lo_image_name);
shippointer->lo_render_handle = -1;
return 0;
} else
@ -1021,7 +1019,7 @@ int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile) {
int weapon_handle = mng_GetGuaranteedWeaponPage(shippage->weapon_name[i][j], infile);
if (weapon_handle < 0) {
mprintf(0, "Couldn't load weapon file '%s' in AssignPowPage %s...\n", shippage->weapon_name[i][j],
LOG_WARNING.printf("Couldn't load weapon file '%s' in AssignPowPage %s...", shippage->weapon_name[i][j],
shippage->ship_struct.name);
shippointer->static_wb[i].gp_weapon_index[j] = LASER_INDEX;
} else
@ -1038,8 +1036,8 @@ int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile) {
int fire_sound_handle = mng_GetGuaranteedSoundPage(shippage->fire_sound_name[i][j], infile);
if (fire_sound_handle < 0) {
mprintf(0, "Couldn't load fire_sound file '%s' in AssignPowPage %s...\n", shippage->fire_sound_name[i][j],
shippage->ship_struct.name);
LOG_WARNING.printf("Couldn't load fire_sound file '%s' in AssignPowPage %s...",
shippage->fire_sound_name[i][j], shippage->ship_struct.name);
shippointer->static_wb[i].fm_fire_sound_index[j] = SOUND_NONE_INDEX;
} else
shippointer->static_wb[i].fm_fire_sound_index[j] = fire_sound_handle;
@ -1053,8 +1051,8 @@ int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile) {
int sound_handle = mng_GetGuaranteedSoundPage(shippage->firing_sound_name[i], infile);
if (sound_handle < 0) {
mprintf(0, "Couldn't load firing_sound file '%s' in AssignPowPage %s...\n", shippage->firing_sound_name[i],
shippage->ship_struct.name);
LOG_WARNING.printf("Couldn't load firing_sound file '%s' in AssignPowPage %s...",
shippage->firing_sound_name[i], shippage->ship_struct.name);
shippointer->firing_sound[i] = SOUND_NONE_INDEX;
} else
shippointer->firing_sound[i] = sound_handle;
@ -1065,8 +1063,8 @@ int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile) {
int sound_handle = mng_GetGuaranteedSoundPage(shippage->release_sound_name[i], infile);
if (sound_handle < 0) {
mprintf(0, "Couldn't load firing_sound file '%s' in AssignPowPage %s...\n", shippage->release_sound_name[i],
shippage->ship_struct.name);
LOG_WARNING.printf("Couldn't load firing_sound file '%s' in AssignPowPage %s...",
shippage->release_sound_name[i], shippage->ship_struct.name);
shippointer->firing_release_sound[i] = SOUND_NONE_INDEX;
} else
shippointer->firing_release_sound[i] = sound_handle;
@ -1077,7 +1075,7 @@ int mng_AssignShipPageToShip(mngs_ship_page *shippage, int n, CFILE *infile) {
shippointer->spew_powerup[i] = mng_GetGuaranteedGenericPage(shippage->spew_powerup_name[i], infile);
if (shippointer->spew_powerup[i] > -1 &&
Object_info[shippointer->spew_powerup[i]].type != OBJ_POWERUP) { // DAJ -1FIX
mprintf(1, "Spew powerup is not a powerup! Setting to none.\n");
LOG_WARNING << "Spew powerup is not a powerup! Setting to none.";
shippointer->spew_powerup[i] = -1;
}
} else
@ -1149,7 +1147,7 @@ void mng_AssignShipToShipPage(int n, mngs_ship_page *shippage) {
if (shippointer->spew_powerup[i] != -1) {
if (Object_info[shippointer->spew_powerup[i]].type != OBJ_POWERUP) {
mprintf(1, "Spew powerup is not a powerup! Setting to none.\n");
LOG_WARNING << "Spew powerup is not a powerup! Setting to none.";
shippage->spew_powerup_name[i][0] = 0;
} else
strcpy(shippage->spew_powerup_name[i], Object_info[shippointer->spew_powerup[i]].name);
@ -1171,7 +1169,7 @@ void mng_LoadNetShipPage(CFILE *infile, bool overlay) {
int n = FindShipName(shippage.ship_struct.name);
if (n != -1) {
if (overlay) {
mprintf(0, "OVERLAYING SHIP %s\n", shippage.ship_struct.name);
LOG_DEBUG.printf("OVERLAYING SHIP %s", shippage.ship_struct.name);
mng_FreePagetypePrimitives(PAGETYPE_SHIP, shippage.ship_struct.name, 0);
mng_AssignShipPageToShip(&shippage, n);
}
@ -1180,7 +1178,7 @@ void mng_LoadNetShipPage(CFILE *infile, bool overlay) {
int ret = mng_SetAndLoadShip(&shippage, infile);
ASSERT(ret >= 0);
} else
mprintf(0, "Could not load shippage named %s!\n", shippage.ship_struct.name);
LOG_WARNING.printf("Could not load shippage named %s!", shippage.ship_struct.name);
}
// Reads a ship page from a local table file. It then allocs a ship and
@ -1225,7 +1223,7 @@ void mng_LoadLocalShipPage(CFILE *infile) {
if (addon->Addon_tracklocks[tidx].pagetype == PAGETYPE_SHIP &&
!stricmp(addon->Addon_tracklocks[tidx].name, shippage.ship_struct.name)) {
// found it!!
mprintf(0, "ShipPage: %s previously loaded\n", shippage.ship_struct.name);
LOG_DEBUG.printf("ShipPage: %s previously loaded\n", shippage.ship_struct.name);
need_to_load_page = false;
break;
}
@ -1292,6 +1290,5 @@ void mng_LoadLocalShipPage(CFILE *infile) {
Ships[i].model_handle); // Unload the data so it will get loaded later after the textures are in memory
}
} else
mprintf(0, "Could not load shippage named %s!\n", shippage.ship_struct.name);
LOG_WARNING.printf("Could not load shippage named %s!", shippage.ship_struct.name);
}

View File

@ -124,10 +124,9 @@
#include "cfile.h"
#include "manage.h"
#include "soundpage.h"
#include "mono.h"
#include "log.h"
#include "pserror.h"
#include "soundload.h"
#include "ddio.h"
#include "args.h"
// soundpage commands that are read/written
@ -349,7 +348,7 @@ int mng_FindSpecificSoundPage(char *name, mngs_sound_page *soundpage, int offset
}
}
if (!infile) {
mprintf(0, "Couldn't open table file to find sound!\n");
LOG_ERROR << "Couldn't open table file to find sound!";
Int3();
return 0;
}
@ -415,7 +414,7 @@ int mng_AssignSoundPageToSound(mngs_sound_page *soundpage, int n) {
// Try and load our sound raw from the disk
raw_handle = LoadSoundFile(soundpage->raw_name, Sounds[n].import_volume, false);
if (raw_handle < 0) {
mprintf(0, "Couldn't load file '%s' in AssignSoundPage...\n", soundpage->raw_name);
LOG_ERROR.printf("Couldn't load file '%s' in AssignSoundPage...", soundpage->raw_name);
soundpointer->sample_index = -1;
return 0;
} else
@ -445,7 +444,7 @@ void mng_LoadNetSoundPage(CFILE *infile, bool overlay) {
int n = FindSoundName(soundpage.sound_struct.name);
if (n != -1) {
if (overlay) {
mprintf(0, "OVERLAYING SOUND %s\n", soundpage.sound_struct.name);
LOG_DEBUG.printf("OVERLAYING SOUND %s", soundpage.sound_struct.name);
mng_FreePagetypePrimitives(PAGETYPE_SOUND, soundpage.sound_struct.name, 0);
mng_AssignSoundPageToSound(&soundpage, n);
}
@ -454,7 +453,7 @@ void mng_LoadNetSoundPage(CFILE *infile, bool overlay) {
int ret = mng_SetAndLoadSound(&soundpage);
ASSERT(ret >= 0);
} else
mprintf(0, "Could not load soundpage named %s!\n", soundpage.sound_struct.name);
LOG_WARNING.printf("Could not load soundpage named %s!", soundpage.sound_struct.name);
}
// Reads a sound page from a local table file. It then allocs a sound and
// loads any raws associated with that sound
@ -495,7 +494,7 @@ void mng_LoadLocalSoundPage(CFILE *infile) {
if (addon->Addon_tracklocks[tidx].pagetype == PAGETYPE_SOUND &&
!stricmp(addon->Addon_tracklocks[tidx].name, soundpage.sound_struct.name)) {
// found it!!
mprintf(0, "SoundPage: %s previously loaded\n", soundpage.sound_struct.name);
LOG_DEBUG.printf("SoundPage: %s previously loaded", soundpage.sound_struct.name);
need_to_load_page = false;
break;
}
@ -552,7 +551,7 @@ void mng_LoadLocalSoundPage(CFILE *infile) {
if (Loading_addon_table == -1)
mng_AllocTrackLock(soundpage.sound_struct.name, PAGETYPE_SOUND);
} else
mprintf(0, "Could not load soundpage named %s!\n", soundpage.sound_struct.name);
LOG_WARNING.printf("Could not load soundpage named %s!", soundpage.sound_struct.name);
}
// First searches through the sound index to see if the sound is already
// loaded. If not, searches in the table file and loads it.

View File

@ -262,13 +262,13 @@
#include "cfile.h"
#include "manage.h"
#include "mem.h"
#include "gametexture.h"
#include "bitmap.h"
#include "mono.h"
#include "log.h"
#include "pserror.h"
#include "texpage.h"
#include "vclip.h"
#include "ddio.h"
#include "args.h"
#include "sounds.h"
#include "soundpage.h"
@ -712,7 +712,7 @@ int mng_ReadNewTexturePage(CFILE *infile, mngs_texture_page *texpage) {
texpage->num_proc_elements = cf_ReadShort(infile);
if (texpage->num_proc_elements > MAX_PROC_ELEMENTS) {
mprintf(0, "Warning! Too many procedural elements!\n");
LOG_ERROR << "Warning! Too many procedural elements!";
Int3();
}
@ -773,7 +773,7 @@ int mng_DeleteTexPageSeries(char *names[], int num_textures, int local) {
infile = cfopen(TableFilename, "rb");
if (!infile) {
mprintf(0, "Couldn't open table file to delete texture!\n");
LOG_ERROR << "Couldn't open table file to delete texture!";
Int3();
return 0;
}
@ -784,7 +784,7 @@ int mng_DeleteTexPageSeries(char *names[], int num_textures, int local) {
outfile = cfopen(TempTableFilename, "wb");
if (!outfile) {
mprintf(0, "Couldn't open temp table file to delete texture!\n");
LOG_ERROR << "Couldn't open temp table file to delete texture!";
cfclose(infile);
Int3();
return 0;
@ -817,7 +817,7 @@ int mng_DeleteTexPageSeries(char *names[], int num_textures, int local) {
{
mng_WriteNewTexturePage(outfile, &texpage1);
} else
mprintf(0, "Deleting %s (%s).\n", names[found], local ? "locally" : "on network");
LOG_DEBUG.printf("Deleting %s (%s).", names[found], local ? "locally" : "on network");
}
cfclose(infile);
@ -871,7 +871,7 @@ int mng_FindSpecificTexPage(char *name, mngs_texture_page *texpage, int offset)
}
if (!infile) {
mprintf(0, "Couldn't open table file to find texture!\n");
LOG_ERROR << "Couldn't open table file to find texture!";
Int3();
return 0;
}
@ -990,7 +990,7 @@ int mng_AssignTexPageToTexture(mngs_texture_page *texpage, int n, CFILE *infile)
bm_handle = LoadTextureImage(texpage->bitmap_name, NULL, NORMAL_TEXTURE, mipped, pageable);
if (bm_handle < 0) {
mprintf(0, "Couldn't load bitmap '%s' in AssignTexPage...\n", texpage->bitmap_name);
LOG_ERROR.printf("Couldn't load bitmap '%s' in AssignTexPage...", texpage->bitmap_name);
tex->bm_handle = 0;
return 0;
} else
@ -1122,7 +1122,7 @@ void mng_LoadNetTexturePage(CFILE *infile, bool overlay) {
n = FindTextureName(texpage1.tex_struct.name);
if (n != -1) {
if (overlay) {
mprintf(0, "OVERLAYING TEXTURE %s\n", texpage1.tex_struct.name);
LOG_DEBUG.printf("OVERLAYING TEXTURE %s", texpage1.tex_struct.name);
mng_FreePagetypePrimitives(PAGETYPE_TEXTURE, texpage1.tex_struct.name, 0);
mng_AssignTexPageToTexture(&texpage1, n);
}
@ -1132,7 +1132,7 @@ void mng_LoadNetTexturePage(CFILE *infile, bool overlay) {
int ret = mng_SetAndLoadTexture(&texpage1, infile);
ASSERT(ret >= 0);
} else
mprintf(0, "Could not load texpage named %s!\n", texpage1.tex_struct.name);
LOG_WARNING.printf("Could not load texpage named %s!", texpage1.tex_struct.name);
}
// Loads in a texture page from a file, superseding any texture with that name
@ -1173,7 +1173,7 @@ void mng_LoadLocalTexturePage(CFILE *infile) {
if (addon->Addon_tracklocks[tidx].pagetype == PAGETYPE_TEXTURE &&
!stricmp(addon->Addon_tracklocks[tidx].name, texpage1.tex_struct.name)) {
// found it!!
mprintf(0, "TexturePage: %s previously loaded\n", texpage1.tex_struct.name);
LOG_DEBUG.printf("TexturePage: %s previously loaded", texpage1.tex_struct.name);
need_to_load_page = false;
break;
}
@ -1233,11 +1233,9 @@ void mng_LoadLocalTexturePage(CFILE *infile) {
mng_AllocTrackLock(texpage1.tex_struct.name, PAGETYPE_TEXTURE);
} else
mprintf(0, "Could not load texpage named %s!\n", texpage1.tex_struct.name);
LOG_WARNING.printf("Could not load texpage named %s!", texpage1.tex_struct.name);
}
#include "mem.h"
// First searches through the texture index to see if the texture is already
// loaded. If not, searches in the table file and loads it.
// Returns index of texture found, -1 if not

View File

@ -294,13 +294,12 @@
#include "manage.h"
#include "weapon.h"
#include "weaponpage.h"
#include "mono.h"
#include "log.h"
#include "pserror.h"
#include "vclip.h"
#include "polymodel.h"
#include "soundpage.h"
#include "soundload.h"
#include "ddio.h"
#include "gametexture.h"
#include "texpage.h"
#include "sounds.h"
@ -755,7 +754,7 @@ void mng_WriteNewWeaponPage(CFILE *outfile, mngs_weapon_page *weaponpage) {
#ifdef OEM
void DoOEMNapalmBarrelHack(mngs_weapon_page *weaponpage) {
if (!strcmp(weaponpage->weapon_struct.name, "NapalmBarrelPart2")) {
mprintf(0, "BASHING NAPALMBARRELPART2!!!!!!\n");
LOG_DEBUG << "BASHING NAPALMBARRELPART2!!!!!!";
weaponpage->weapon_struct.flags |= (WF_SATURATE | WF_NO_ROTATE | WF_CUSTOM_SIZE | WF_NAPALM);
weaponpage->weapon_struct.custom_size = 6.0f;
weaponpage->weapon_struct.phys_info.mass = 0.6f;
@ -767,7 +766,7 @@ void DoOEMNapalmBarrelHack(mngs_weapon_page *weaponpage) {
weaponpage->weapon_struct.phys_info.velocity.z = 50.0f;
} else {
mprintf(0, "BASHING NAPALMBARREL!!!!!!\n");
LOG_DEBUG << "BASHING NAPALMBARREL!!!!!!";
weaponpage->weapon_struct.flags |= (WF_INVISIBLE | WF_CUSTOM_SIZE | WF_NAPALM);
weaponpage->weapon_struct.custom_size = 1.0f;
weaponpage->weapon_struct.phys_info.flags |= PF_USES_PARENT_VELOCITY;
@ -1193,7 +1192,7 @@ int mng_FindSpecificWeaponPage(char *name, mngs_weapon_page *weaponpage) {
}
if (!infile) {
mprintf(0, "Couldn't open table file to find weapon!\n");
LOG_ERROR << "Couldn't open table file to find weapon!";
Int3();
return 0;
}
@ -1270,7 +1269,7 @@ int mng_FindSpecificWeaponPage(char *name, mngs_weapon_page *weaponpage, int off
}
if (!infile) {
mprintf(0, "Couldn't open table file to find weapon!\n");
LOG_ERROR << "Couldn't open table file to find weapon!";
Int3();
return 0;
}
@ -1405,7 +1404,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = bm_AllocLoadFileBitmap(weaponpage->hud_image_name, 0);
if (img_handle < 0) {
mprintf(0, "Couldn't load bitmap '%s' in AssignWeaponPage...\n", weaponpage->hud_image_name);
LOG_ERROR.printf("Couldn't load bitmap '%s' in AssignWeaponPage...", weaponpage->hud_image_name);
weaponpointer->hud_image_handle = -1;
Weapon_error = "Can't load HUD image";
Weapon_error_filename = weaponpage->hud_image_name;
@ -1421,7 +1420,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = LoadPolyModel(weaponpage->fire_image_name, 1);
if (img_handle < 0) {
mprintf(0, "Couldn't load bitmap/model '%s' in AssignWeaponPage...\n", weaponpage->fire_image_name);
LOG_ERROR.printf("Couldn't load bitmap/model '%s' in AssignWeaponPage...", weaponpage->fire_image_name);
weaponpointer->fire_image_handle = -1;
Weapon_error = "Can't load fire image";
Weapon_error_filename = weaponpage->fire_image_name;
@ -1443,7 +1442,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = mng_GetGuaranteedTexturePage(weaponpage->explode_image_name, infile);
if (img_handle < 0) {
mprintf(0, "Couldn't load bitmap/model '%s' in AssignWeaponPage...\n", weaponpage->explode_image_name);
LOG_ERROR.printf("Couldn't load bitmap/model '%s' in AssignWeaponPage...", weaponpage->explode_image_name);
weaponpointer->explode_image_handle = -1;
} else
weaponpointer->explode_image_handle = img_handle;
@ -1455,7 +1454,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = mng_GetGuaranteedTexturePage(weaponpage->particle_name, infile);
if (img_handle < 0) {
mprintf(0, "Couldn't load bitmap/model '%s' in AssignWeaponPage...\n", weaponpage->particle_name);
LOG_ERROR.printf("Couldn't load bitmap/model '%s' in AssignWeaponPage...", weaponpage->particle_name);
weaponpointer->particle_handle = -1;
} else
weaponpointer->particle_handle = img_handle;
@ -1467,7 +1466,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = mng_GetGuaranteedWeaponPage(weaponpage->spawn_name, infile);
if (img_handle < 0) {
mprintf(0, "Couldn't load spawn weapon '%s' in AssignWeaponPage...\n", weaponpage->spawn_name);
LOG_ERROR.printf("Couldn't load spawn weapon '%s' in AssignWeaponPage...", weaponpage->spawn_name);
weaponpointer->spawn_handle = -1;
} else
weaponpointer->spawn_handle = img_handle;
@ -1478,7 +1477,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = mng_GetGuaranteedWeaponPage(weaponpage->alternate_spawn_name, infile);
if (img_handle < 0) {
mprintf(0, "Couldn't load alternate spawn weapon '%s' in AssignWeaponPage...\n",
LOG_ERROR.printf("Couldn't load alternate spawn weapon '%s' in AssignWeaponPage...",
weaponpage->alternate_spawn_name);
weaponpointer->alternate_spawn_handle = -1;
} else
@ -1491,7 +1490,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = mng_GetGuaranteedGenericPage(weaponpage->robot_spawn_name, infile);
if (img_handle < 0) {
mprintf(0, "Couldn't load robot spawn weapon '%s' in AssignWeaponPage...\n", weaponpage->robot_spawn_name);
LOG_WARNING.printf("Couldn't load robot spawn weapon '%s' in AssignWeaponPage...", weaponpage->robot_spawn_name);
weaponpointer->robot_spawn_handle = -1;
} else
weaponpointer->robot_spawn_handle = img_handle;
@ -1503,7 +1502,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = mng_GetGuaranteedTexturePage(weaponpage->smoke_image_name, infile);
if (img_handle < 0) {
mprintf(0, "Couldn't load smoke trail file '%s' in AssignWeaponPage...\n", weaponpage->smoke_image_name);
LOG_WARNING.printf("Couldn't load smoke trail file '%s' in AssignWeaponPage...", weaponpage->smoke_image_name);
weaponpointer->flags &= ~WF_SMOKE;
weaponpointer->smoke_handle = -1;
@ -1519,7 +1518,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = mng_GetGuaranteedTexturePage(weaponpage->scorch_image_name, infile);
if (img_handle < 0) {
mprintf(0, "Couldn't load scorch file '%s' in AssignWeaponPage...\n", weaponpage->scorch_image_name);
LOG_WARNING.printf("Couldn't load scorch file '%s' in AssignWeaponPage...", weaponpage->scorch_image_name);
weaponpointer->scorch_handle = -1;
} else
@ -1533,7 +1532,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
img_handle = mng_GetGuaranteedTexturePage(weaponpage->icon_name, infile);
if (img_handle < 0) {
mprintf(0, "Couldn't load icon file '%s' in AssignWeaponPage...\n", weaponpage->icon_name);
LOG_WARNING.printf("Couldn't load icon file '%s' in AssignWeaponPage...", weaponpage->icon_name);
weaponpointer->icon_handle = -1;
} else
@ -1548,7 +1547,7 @@ int mng_AssignWeaponPageToWeapon(mngs_weapon_page *weaponpage, int n, CFILE *inf
sound_handle = mng_GetGuaranteedSoundPage(weaponpage->sound_name[i]);
if (sound_handle < 0) {
mprintf(0, "Couldn't load sound file '%s' in AssignWeaponPage. Weapon=%s\n", weaponpage->sound_name[i],
LOG_WARNING.printf("Couldn't load sound file '%s' in AssignWeaponPage. Weapon=%s", weaponpage->sound_name[i],
weaponpage->weapon_struct.name);
weaponpointer->sounds[i] = SOUND_NONE_INDEX;
} else
@ -1654,7 +1653,7 @@ void mng_LoadNetWeaponPage(CFILE *infile, bool overlay) {
int n = FindWeaponName(weaponpage.weapon_struct.name);
if (n != -1) {
if (overlay) {
mprintf(0, "OVERLAYING WEAPON %s\n", weaponpage.weapon_struct.name);
LOG_DEBUG.printf("OVERLAYING WEAPON %s", weaponpage.weapon_struct.name);
mng_FreePagetypePrimitives(PAGETYPE_WEAPON, weaponpage.weapon_struct.name, 0);
mng_AssignWeaponPageToWeapon(&weaponpage, n);
}
@ -1665,7 +1664,7 @@ void mng_LoadNetWeaponPage(CFILE *infile, bool overlay) {
int ret = mng_SetAndLoadWeapon(&weaponpage, infile);
ASSERT(ret >= 0);
} else
mprintf(0, "Could not load weaponpage named %s!\n", weaponpage.weapon_struct.name);
LOG_WARNING.printf("Could not load weaponpage named %s!", weaponpage.weapon_struct.name);
}
// Reads a weapon page from a local table file. It then allocs a weapon and
@ -1708,7 +1707,7 @@ void mng_LoadLocalWeaponPage(CFILE *infile) {
if (addon->Addon_tracklocks[tidx].pagetype == PAGETYPE_WEAPON &&
!stricmp(addon->Addon_tracklocks[tidx].name, weaponpage.weapon_struct.name)) {
// found it!!
mprintf(0, "WeaponPage: %s previously loaded\n", weaponpage.weapon_struct.name);
LOG_DEBUG.printf("WeaponPage: %s previously loaded", weaponpage.weapon_struct.name);
need_to_load_page = false;
break;
}
@ -1769,5 +1768,5 @@ void mng_LoadLocalWeaponPage(CFILE *infile) {
mng_AllocTrackLock(weaponpage.weapon_struct.name, PAGETYPE_WEAPON);
} else
mprintf(0, "Could not load weaponpage named %s!\n", weaponpage.weapon_struct.name);
LOG_WARNING.printf("Could not load weaponpage named %s!", weaponpage.weapon_struct.name);
}