More cleanup, and I've replaced most - not quite all - of BS2's debug

message functions with our own.

We still need to go through them and assign sensible debug levels to them.

svn-id: r10422
This commit is contained in:
Torbjörn Andersson 2003-09-27 11:02:58 +00:00
parent 5f2d799fd2
commit 8ad28e3a7e
32 changed files with 1322 additions and 1872 deletions

View File

@ -35,7 +35,6 @@
#include "anims.h"
#include "console.h"
#include "controls.h" // for 'speechSelected' & 'subtitles'
#include "debug.h"
#include "defs.h"
#include "header.h"
#include "interpreter.h"
@ -156,7 +155,7 @@ int32 Animate(int32 *params, uint8 reverse_flag) {
#ifdef _SWORD2_DEBUG
// check that we haven't been passed a zero resource number
if (res == 0)
Con_fatal_error("Animate: %s (id %d) passed zero anim resource (%s line %u)", FetchObjectName(ID), ID, __FILE__, __LINE__);
Con_fatal_error("Animate: %s (id %d) passed zero anim resource", FetchObjectName(ID), ID);
#endif
// open anim file
@ -166,7 +165,7 @@ int32 Animate(int32 *params, uint8 reverse_flag) {
// check this this resource is actually an animation file!
head = (_standardHeader *) anim_file;
if (head->fileType != ANIMATION_FILE)
Con_fatal_error("Animate: %s (%d) is not an anim! (%s line %u)", FetchObjectName(res), res, __FILE__, __LINE__);
Con_fatal_error("Animate: %s (%d) is not an anim!", FetchObjectName(res), res);
#endif
// point to anim header
@ -175,7 +174,7 @@ int32 Animate(int32 *params, uint8 reverse_flag) {
/* #ifdef _SWORD2_DEBUG
// check there's at least one frame
if (anim_head->noAnimFrames == 0)
Con_fatal_error("Animate: %s (%d) has zero frame count! (%s line %u)", FetchObjectName(res), res, __FILE__, __LINE__);
Con_fatal_error("Animate: %s (%d) has zero frame count!", FetchObjectName(res), res);
#endif */
// now running an anim, looping back to this 'FN' call again
@ -188,7 +187,7 @@ int32 Animate(int32 *params, uint8 reverse_flag) {
ob_graphic->anim_pc = 0;
} else if (Get_sync()) {
// We've received a sync - return to script immediately
// Zdebug("**sync stopped %d**", ID);
debug(5, "**sync stopped %d**", ID);
// If sync received, anim finishes right now (remaining on
// last frame). Quit animation, but continue script.
@ -278,7 +277,7 @@ int32 FN_set_frame(int32 *params) {
#ifdef _SWORD2_DEBUG
// check that we haven't been passed a zero resource number
if (res == 0)
Con_fatal_error("FN_set_frame: %s (id %d) passed zero anim resource (%s line %u)", FetchObjectName(ID), ID, __FILE__, __LINE__);
Con_fatal_error("FN_set_frame: %s (id %d) passed zero anim resource", FetchObjectName(ID), ID);
#endif
// open the resource (& check it's valid)
@ -289,7 +288,7 @@ int32 FN_set_frame(int32 *params) {
// check this this resource is actually an animation file!
head = (_standardHeader *) anim_file;
if (head->fileType != ANIMATION_FILE)
Con_fatal_error("FN_set_frame: %s (%d) is not an anim! (%s line %u)", FetchObjectName(res), res, __FILE__, __LINE__);
Con_fatal_error("FN_set_frame: %s (%d) is not an anim!", FetchObjectName(res), res);
#endif
// set up pointer to the animation header
@ -298,7 +297,7 @@ int32 FN_set_frame(int32 *params) {
/* #ifdef _SWORD2_DEBUG
// check there's at least one frame
if (anim_head->noAnimFrames == 0)
Con_fatal_error("FN_set_frame: %s (%d) has zero frame count! (%s line %u)", FetchObjectName(res), res, __FILE__, __LINE__);
Con_fatal_error("FN_set_frame: %s (%d) has zero frame count!", FetchObjectName(res), res);
#endif */
// set up anim resource in graphic object
@ -495,7 +494,7 @@ int32 FN_add_sequence_text(int32 *params) {
#ifdef _SWORD2_DEBUG
if (sequenceTextLines == MAX_SEQUENCE_TEXT_LINES)
Con_fatal_error("FN_add_sequence_text ran out of lines (%s line %u)",__FILE__,__LINE__);
Con_fatal_error("FN_add_sequence_text ran out of lines");
#endif
sequence_text_list[sequenceTextLines].textNumber = params[0];
@ -538,11 +537,8 @@ void CreateSequenceSpeech(_movieTextObject *sequenceText[]) {
// now ok to close the text file
res_man.Res_close(text_res);
#ifdef _SWORD2_DEBUG
// Write to walkthrough file (zebug0.txt)
// 1st word of text line is the official line number
Zdebug(0,"(%d) SEQUENCE TEXT: %s", *(uint16 *) text, text + 2);
#endif
debug(5,"(%d) SEQUENCE TEXT: %s", *(uint16 *) text, text + 2);
// is it to be speech or subtitles or both?
// assume speech is not running until know otherwise
@ -669,17 +665,15 @@ int32 FN_smacker_lead_in(int32 *params) {
#ifdef _SWORD2_DEBUG
header = (_standardHeader *) leadIn;
if (header->fileType != WAV_FILE)
Con_fatal_error("FN_smacker_lead_in() given invalid resource (%s line %u)", __FILE__, __LINE__);
Con_fatal_error("FN_smacker_lead_in() given invalid resource");
#endif
leadIn += sizeof(_standardHeader);
// wav data gets copied to sound memory
rv = g_sound->PlayFx(0, leadIn, 0, 0, RDSE_FXLEADIN);
#ifdef _SWORD2_DEBUG
if (rv)
Zdebug("SFX ERROR: PlayFx() returned %.8x (%s line %u)", rv, __FILE__, __LINE__);
#endif
debug(5, "SFX ERROR: PlayFx() returned %.8x", rv);
res_man.Res_close(params[0]);
@ -716,22 +710,20 @@ int32 FN_play_sequence(int32 *params) {
// of computer games" - but at the very least we want to show the
// cutscene subtitles, so I removed them.
Zdebug("FN_play_sequence(\"%s\");", params[0]);
debug(5, "FN_play_sequence(\"%s\");", params[0]);
#ifdef _SWORD2_DEBUG
// check that the name paseed from script is 8 chars or less
if (strlen((char *) params[0]) > 8)
Con_fatal_error("Sequence filename too long (%s line %u)", __FILE__, __LINE__);
Con_fatal_error("Sequence filename too long");
#endif
// add the appropriate file extension & play it
sprintf(filename, "%s.smk", (char *) params[0]);
#ifdef _SWORD2_DEBUG
// Write to walkthrough file (zebug0.txt)
Zdebug(0,"PLAYING SEQUENCE \"%s\"", filename);
#endif
debug(5, "PLAYING SEQUENCE \"%s\"", filename);
// now create the text sprites, if any (James27may97)
@ -746,7 +738,7 @@ int32 FN_play_sequence(int32 *params) {
#ifdef _SWORD2_DEBUG
header = (_standardHeader *)leadOut;
if (header->fileType != WAV_FILE)
Con_fatal_error("FN_smacker_lead_out() given invalid resource (%s line %u)", __FILE__, __LINE__);
error("FN_smacker_lead_out() given invalid resource");
#endif
leadOut += sizeof(_standardHeader);
@ -775,11 +767,9 @@ int32 FN_play_sequence(int32 *params) {
smackerLeadOut = 0;
}
#ifdef _SWORD2_DEBUG
// check the error return-value
if (rv)
Zdebug("PlaySmacker(\"%s\") returned 0x%.8x", filename, rv);
#endif
debug(5, "PlaySmacker(\"%s\") returned 0x%.8x", filename, rv);
// now clear the text sprites, if any (James27may97)
@ -798,7 +788,7 @@ int32 FN_play_sequence(int32 *params) {
memset(pal, 0, 256 * sizeof(_palEntry));
BS2_SetPalette(0, 256, (uint8 *) pal, RDPAL_INSTANT);
Zdebug("FN_play_sequence FINISHED");
debug(5, "FN_play_sequence FINISHED");
// continue script
return IR_CONT;

View File

@ -303,7 +303,7 @@ void Build_display(void) { //Tony21Sept96
rv = DrawSprite(&spriteInfo);
if (rv)
ExitWithReport("Driver Error %.8x (drawing console) [%s line %u]", rv, __FILE__, __LINE__);
error("Driver Error %.8x (drawing console)", rv);
CopyScreenBuffer();
} else{
@ -366,7 +366,7 @@ void DisplayMsg(uint8 *text, int time) {
rv = DrawSprite(&spriteInfo);
if (rv)
ExitWithReport("Driver Error %.8x (in DisplayMsg) [%s line %u]", rv, __FILE__, __LINE__);
error("Driver Error %.8x (in DisplayMsg)", rv);
spriteInfo.x = oldX;
spriteInfo.y = oldY;
@ -396,7 +396,7 @@ void DisplayMsg(uint8 *text, int time) {
rv = DrawSprite(&spriteInfo); // Keep the message there even when the user task swaps.
if (rv)
ExitWithReport("Driver Error %.8x (in DisplayMsg) [%s line %u]", rv, __FILE__, __LINE__);
error("Driver Error %.8x (in DisplayMsg)", rv);
// Drivers change the y co-ordinate, don't know why...
spriteInfo.y = oldY;
@ -552,7 +552,7 @@ void Process_layer(uint32 layer_number) {
rv = DrawSprite(&spriteInfo);
if (rv)
ExitWithReport("Driver Error %.8x in Process_layer(%d) [%s line %u]", rv, layer_number, __FILE__, __LINE__);
error("Driver Error %.8x in Process_layer(%d)", rv, layer_number);
res_man.Res_close(this_screen.background_layer_id);
}
@ -633,7 +633,7 @@ void Process_image(buildit *build_unit) {
spriteInfo.type = spriteType;
spriteInfo.blend = anim_head->blend;
// points to just after frame header, ie. start of sprite data
spriteInfo.data = (uint8*) (frame_head + 1);
spriteInfo.data = (uint8 *) (frame_head + 1);
spriteInfo.colourTable = colTablePtr;
#ifdef _SWORD2_DEBUG
@ -680,13 +680,15 @@ void Process_image(buildit *build_unit) {
// #ifdef _SWORD2_DEBUG
// if (frame_head->width <= 1) {
// Zdebug(8,"WARNING: 1-pixel-wide frame found in %s (%d)", FetchObjectName(build_unit->anim_resource), build_unit->anim_resource);
// debug(5, "WARNING: 1-pixel-wide frame found in %s (%d)", FetchObjectName(build_unit->anim_resource), build_unit->anim_resource);
// }
// #endif
rv = DrawSprite(&spriteInfo);
if (rv)
ExitWithReport("Driver Error %.8x with sprite %s (%d) in Process_image [%s line %u]", rv, FetchObjectName(build_unit->anim_resource), build_unit->anim_resource, __FILE__, __LINE__);
error("Driver Error %.8x with sprite %s (%d) in Process_image",
rv, FetchObjectName(build_unit->anim_resource),
build_unit->anim_resource);
// release the anim resource
res_man.Res_close(build_unit->anim_resource);
@ -759,7 +761,7 @@ void Register_frame(int32 *params, buildit *build_unit) {
#ifdef _SWORD2_DEBUG
if (ob_graph->anim_resource == 0)
Con_fatal_error("ERROR: %s(%d) has no anim resource in Register_frame [line=%d file=%s]", FetchObjectName(ID), ID, __LINE__, __FILE__);
Con_fatal_error("ERROR: %s(%d) has no anim resource in Register_frame", FetchObjectName(ID), ID);
#endif
file = res_man.Res_open(ob_graph->anim_resource);
@ -847,7 +849,7 @@ void Register_frame(int32 *params, buildit *build_unit) {
if (ob_mouse->pointer) {
#ifdef _SWORD2_DEBUG
if (cur_mouse == TOTAL_mouse_list)
Con_fatal_error("ERROR: mouse_list full [%s line %u]",__FILE__,__LINE__);
Con_fatal_error("ERROR: mouse_list full");
#endif
mouse_list[cur_mouse].x1 = build_unit->x;
@ -897,7 +899,7 @@ int32 FN_register_frame(int32 *params) {
case BGP0_SPRITE:
#ifdef _SWORD2_DEBUG
if (cur_bgp0 == MAX_bgp0_sprites)
Con_fatal_error("ERROR: bgp0_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
Con_fatal_error("ERROR: bgp0_list full in FN_register_frame");
#endif
Register_frame(params, &bgp0_list[cur_bgp0]);
@ -906,7 +908,7 @@ int32 FN_register_frame(int32 *params) {
case BGP1_SPRITE:
#ifdef _SWORD2_DEBUG
if (cur_bgp1 == MAX_bgp1_sprites)
Con_fatal_error("ERROR: bgp1_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
Con_fatal_error("ERROR: bgp1_list full in FN_register_frame");
#endif
Register_frame(params, &bgp1_list[cur_bgp1]);
@ -915,7 +917,7 @@ int32 FN_register_frame(int32 *params) {
case BACK_SPRITE:
#ifdef _SWORD2_DEBUG
if (cur_back == MAX_back_sprites)
Con_fatal_error("ERROR: back_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
Con_fatal_error("ERROR: back_list full in FN_register_frame");
#endif
Register_frame(params, &back_list[cur_back]);
@ -924,7 +926,7 @@ int32 FN_register_frame(int32 *params) {
case SORT_SPRITE:
#ifdef _SWORD2_DEBUG
if (cur_sort == MAX_sort_sprites)
Con_fatal_error("ERROR: sort_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
Con_fatal_error("ERROR: sort_list full in FN_register_frame");
#endif
sort_order[cur_sort] = cur_sort;
@ -934,7 +936,7 @@ int32 FN_register_frame(int32 *params) {
case FORE_SPRITE:
#ifdef _SWORD2_DEBUG
if (cur_fore == MAX_fore_sprites)
Con_fatal_error("ERROR: fore_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
Con_fatal_error("ERROR: fore_list full in FN_register_frame");
#endif
Register_frame(params, &fore_list[cur_fore]);
@ -943,7 +945,7 @@ int32 FN_register_frame(int32 *params) {
case FGP0_SPRITE:
#ifdef _SWORD2_DEBUG
if (cur_fgp0 == MAX_fgp0_sprites)
Con_fatal_error("ERROR: fgp0_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
Con_fatal_error("ERROR: fgp0_list full in FN_register_frame");
#endif
Register_frame(params, &fgp0_list[cur_fgp0]);
@ -952,7 +954,7 @@ int32 FN_register_frame(int32 *params) {
case FGP1_SPRITE:
#ifdef _SWORD2_DEBUG
if (cur_fgp1 == MAX_fgp1_sprites)
Con_fatal_error("ERROR: fgp1_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
Con_fatal_error("ERROR: fgp1_list full in FN_register_frame");
#endif
Register_frame(params, &fgp1_list[cur_fgp1]);
@ -1011,7 +1013,7 @@ int32 FN_update_player_stats(int32 *params) {
SCROLL_OFFSET_X = this_screen.scroll_offset_x;
// Zdebug(42,"%d %d", ob_mega->feet_x, ob_mega->feet_y);
debug(5, "FN_Update_player_stats: %d %d", ob_mega->feet_x, ob_mega->feet_y);
return IR_CONT;
}
@ -1103,7 +1105,7 @@ void SetFullPalette(int32 palRes) {
#ifdef _SWORD2_DEBUG
if (head->fileType != PALETTE_FILE)
Con_fatal_error("FN_set_palette() called with invalid resource! (%s line %u)",__FILE__,__LINE__);
Con_fatal_error("FN_set_palette() called with invalid resource!");
#endif
file = (uint8*) (head + 1);
@ -1144,7 +1146,7 @@ void SetFullPalette(int32 palRes) {
// close screen file
res_man.Res_close(this_screen.background_layer_id);
} else
Con_fatal_error("FN_set_palette(0) called, but no current screen available! (%s line %u)",__FILE__,__LINE__);
Con_fatal_error("FN_set_palette(0) called, but no current screen available!");
}
}
@ -1160,7 +1162,7 @@ int32 FN_change_shadows(int32 *params) {
rv = CloseLightMask();
if (rv)
ExitWithReport("Driver Error %.8x [%s line %u]", rv, __FILE__, __LINE__);
error("Driver Error %.8x [%s line %u]", rv);
this_screen.mask_flag = 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -25,57 +25,41 @@
#ifdef _SWORD2_DEBUG
void Init_console(void); //Tony9Sept96
uint32 One_console(void); //Tony12Aug96
void StartConsole(void); //Tony12Aug96
void EndConsole(void); //Tony9Oct96
void Init_console(void);
uint32 One_console(void);
void StartConsole(void);
void EndConsole(void);
void Con_fatal_error(const char *format,...);
void Print_to_console(const char *format,...); //Tony13Aug96
void Temp_print_to_console(const char *format,...); //Tony13Aug96
void Scroll_console(void); //Tony13Aug96
void Clear_console_line(void); //Tony13Aug96
void Con_fatal_error(const char *format, ...);
void Print_to_console(const char *format, ...);
void Temp_print_to_console(const char *format, ...);
void Scroll_console(void);
void Clear_console_line(void);
extern mem *console_sprite;
extern uint32 con_y;
extern uint32 con_depth;
extern uint32 con_width;
extern mem *console_sprite;
extern uint32 con_y;
extern uint32 con_depth;
extern uint32 con_width;
extern uint8 grabbingSequences;
extern uint8 wantSfxDebug; // sfx debug file enabled/disabled from console
#else
#else // _SWORD2_DEBUG
/*
#define Init_console NULL
#define One_console NULL
#define StartConsole NULL
#define EndConsole NULL
*/
void Init_console(void);
uint32 One_console(void);
void StartConsole(void);
void EndConsole(void);
void Init_console(void);
uint32 One_console(void);
void StartConsole(void);
void EndConsole(void);
#define Con_fatal_error error
// 'Con_fatal_error' commands map to ExitWithReport
// so we show errors in a window rather than our development game console
#define Con_fatal_error ExitWithReport
void Print_to_console(const char *format, ...);
void Temp_print_to_console(const char *format, ...);
void Clear_console_line(void);
void Scroll_console(void);
//#define Print_to_console NULL
//#define Temp_print_to_console NULL
//#define Clear_console_line NULL
//#define Scroll_console NULL
void Print_to_console(const char *format,...);
void Temp_print_to_console(const char *format,...);
void Clear_console_line(void);
void Scroll_console(void);
//#define Var_check NULL
//#define Var_set NULL
#endif // _SWORD2_DEBUG
#endif
extern uint32 console_status;
#endif

View File

@ -17,23 +17,22 @@
* $Header$
*/
//--------------------------------------------------------------------------------------
#include <stdarg.h> // for ExitWithReport, which stays in RELEASE version
#include <stdio.h>
#include "stdafx.h"
#include "driver/driver96.h"
#include "debug.h"
//--------------------------------------------------------------------------------------
#ifdef _SWORD2_DEBUG // this whole file (except ExitWithReport) only included on debug versions
// this whole file (except ExitWithReport) only included on debug versions
#ifdef _SWORD2_DEBUG
#include <stdlib.h>
#include "build_display.h" // for 'fps' (frames-per-second counter)
#include "build_display.h" // for 'fps'
#include "console.h"
#include "defs.h"
#include "events.h" // for CountEvents()
#include "events.h" // for CountEvents()
#include "layers.h"
#include "logic.h"
#include "maketext.h"
@ -41,213 +40,107 @@
#include "mouse.h"
#include "protocol.h"
#include "resman.h"
#include "router.h" // for PlotWalkGrid()
#include "speech.h" // for 'officialTextNumber' and 'speechScriptWaiting'
#include "router.h" // for PlotWalkGrid()
#include "speech.h" // for 'officialTextNumber' and
// 'speechScriptWaiting'
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
// global variables
uint8 displayDebugText = 0; // "INFO" 0=off; 1=on
uint8 displayWalkGrid = 0; // "WALKGRID"
uint8 displayMouseMarker = 0; // "MOUSE"
uint8 displayTime = 0; // "TIME"
uint8 displayPlayerMarker = 0; // "PLAYER"
uint8 displayTextNumbers = 0; // "TEXT"
uint8 renderSkip = 0; // Toggled on 'S' key - to render only 1 in 4 frames, to speed up game
uint8 displayDebugText = 0; // "INFO" 0=off; 1=on
uint8 displayWalkGrid = 0; // "WALKGRID"
uint8 displayMouseMarker = 0; // "MOUSE"
uint8 displayTime = 0; // "TIME"
uint8 displayPlayerMarker = 0; // "PLAYER"
uint8 displayTextNumbers = 0; // "TEXT"
uint8 renderSkip = 0; // Toggled on 'S' key - to render only
// 1 in 4 frames, to speed up game
uint8 definingRectangles = 0; // "RECT"
uint8 draggingRectangle = 0; // 0=waiting to start new rect; 1=currently dragging a rectangle
int16 rect_x1 = 0;
int16 rect_y1 = 0;
int16 rect_x2 = 0;
int16 rect_y2 = 0;
uint8 rectFlicker=0;
uint8 definingRectangles = 0; // "RECT"
uint8 draggingRectangle = 0; // 0=waiting to start new rect;
// 1=currently dragging a rectangle
int16 rect_x1 = 0;
int16 rect_y1 = 0;
int16 rect_x2 = 0;
int16 rect_y2 = 0;
uint8 rectFlicker = 0;
uint8 testingSnR = 0; // "SAVEREST" - for system to kill all object resources (except player) in FN_add_human()
uint8 testingSnR = 0; // "SAVEREST" - for system to kill all
// object resources (except player) in
// FN_add_human()
int32 startTime = 0; // "TIMEON" & "TIMEOFF" - system start time.
int32 gameCycle = 0; // Counter for game clocks.
int32 startTime = 0; // "TIMEON" & "TIMEOFF" - system start
// time.
int32 gameCycle = 0; // Counter for game clocks.
int32 textNumber = 0; // current system text line number
int32 textNumber = 0; // Current system text line number
int32 showVar[MAX_SHOWVARS]; // "SHOWVAR"
Object_graphic playerGraphic; // for displaying player object's current graphical info
uint32 player_graphic_no_frames=0; // no. of frames in currently displayed anim
Object_graphic playerGraphic; // For displaying player object's
// current graphical info
uint32 player_graphic_no_frames = 0; // No. of frames in currently displayed
// anim
uint8 debug_text_blocks[MAX_DEBUG_TEXT_BLOCKS];
//--------------------------------------------------------------------------------------
// function prototypes
void Clear_debug_text_blocks(void);
void Make_debug_text_block(char *text, int16 x, int16 y);
void Plot_cross_hair(int16 x, int16 y, uint8 pen);
void DrawRect(int16 x, int16 y, int16 x2, int16 y2, uint8 pen);
void Clear_debug_text_blocks( void );
void Make_debug_text_block( char *text, int16 x, int16 y );
void Plot_cross_hair( int16 x, int16 y, uint8 pen );
void DrawRect( int16 x, int16 y, int16 x2, int16 y2, uint8 pen );
//--------------------------------------------------------------------------------------
#endif // _SWORD2_DEBUG
void Clear_debug_text_blocks(void) {
uint8 blockNo = 0;
// THIS FUNCTION STAYS IN THE RELEASE VERSION
// IN FACT, CON_FATAL_ERROR IS MAPPED TO THIS AS WELL, SO WE HAVE A MORE PRESENTABLE ERROR REPORT
void ExitWithReport(const char *format,...) // (6dec96 JEL)
{
// Send a printf type string to Paul's windows routine
char buf[500];
va_list arg_ptr; // Variable argument pointer
while (blockNo < MAX_DEBUG_TEXT_BLOCKS && debug_text_blocks[blockNo] > 0) {
// kill the system text block
Kill_text_bloc(debug_text_blocks[blockNo]);
va_start(arg_ptr,format);
// clear this element of our array of block numbers
debug_text_blocks[blockNo] = 0;
vsprintf(buf, format, arg_ptr);
Zdebug("%s",buf); // send output to 'debug.txt' as well, just for the record
// wait for fade to finish before calling RestoreDisplay()
WaitForFade();
error(buf);
}
#ifdef _SWORD2_DEBUG // all other functions only for _SWORD2_DEBUG version
//--------------------------------------------------------------------------------------
void Zdebug(const char *format,...) //Tony's special debug logging file March96
{
// Write a printf type string to a debug file
va_list arg_ptr; // Variable argument pointer
FILE * debug_filep=0; // Debug file pointer
static int first_debug = 1; // Flag for first time this is used
va_start(arg_ptr,format);
if (first_debug) //First time round delete any previous debug file
{
unlink("debug.txt");
first_debug = 0;
}
debug_filep = fopen("debug.txt","a+t");
if (debug_filep != NULL) // if it could be opened
{
vfprintf(debug_filep, format, arg_ptr);
fprintf(debug_filep,"\n");
fclose(debug_filep);
}
}
//--------------------------------------------------------------------------------------
void Zdebug(uint32 stream, const char *format,...) //Tony's special debug logging file March96
{
// Write a printf type string to a debug file
va_list arg_ptr; // Variable argument pointer
FILE * debug_filep=0; // Debug file pointer
static int first = 1; // Flag for first time this is used
int j;
static int first_debugs[100];
if (first==1) //first time run then reset the states
{ for (j=0;j<100;j++)
first_debugs[j]=0;
first=0;
}
char name[20];
sprintf(name, "debug%d.txt", stream);
va_start(arg_ptr,format);
if (!first_debugs[stream]) //First time round delete any previous debug file
{
unlink(name);
first_debugs[stream] = 1;
}
debug_filep = fopen(name,"a+t");
if (debug_filep != NULL) // if it could be opened
{
vfprintf(debug_filep, format, arg_ptr);
fprintf(debug_filep,"\n");
fclose(debug_filep);
}
}
//--------------------------------------------------------------------------------------
void Clear_debug_text_blocks( void ) // JAMES
{
uint8 blockNo=0;
while ((blockNo < MAX_DEBUG_TEXT_BLOCKS) && (debug_text_blocks[blockNo] > 0))
{
Kill_text_bloc(debug_text_blocks[blockNo]); // kill the system text block
debug_text_blocks[blockNo] = 0; // clear this element of our array of block numbers
blockNo++;
}
}
//--------------------------------------------------------------------------------------
void Make_debug_text_block( char *text, int16 x, int16 y) // JAMES
{
uint8 blockNo=0;
void Make_debug_text_block(char *text, int16 x, int16 y) {
uint8 blockNo = 0;
while ((blockNo < MAX_DEBUG_TEXT_BLOCKS) && (debug_text_blocks[blockNo] > 0))
while (blockNo < MAX_DEBUG_TEXT_BLOCKS && debug_text_blocks[blockNo] > 0)
blockNo++;
if (blockNo == MAX_DEBUG_TEXT_BLOCKS)
Con_fatal_error("ERROR: debug_text_blocks[] full in Make_debug_text_block() at line %d in file \"%s\"",__LINE__,__FILE__);
Con_fatal_error("ERROR: debug_text_blocks[] full in Make_debug_text_block()");
debug_text_blocks[blockNo] = Build_new_block( (uint8 *)text, x, y, 640-x, 0, RDSPR_DISPLAYALIGN, CONSOLE_FONT_ID, NO_JUSTIFICATION);
debug_text_blocks[blockNo] = Build_new_block((uint8 *) text, x, y, 640 - x, 0, RDSPR_DISPLAYALIGN, CONSOLE_FONT_ID, NO_JUSTIFICATION);
}
//--------------------------------------------------------------------------------------
//
//
// PC Build_debug_info
//
//
//--------------------------------------------------------------------------------------
void Build_debug_text( void ) // JAMES
{
void Build_debug_text(void) {
char buf[128];
int32 showVarNo; // for variable watching
int32 showVarNo; // for variable watching
int32 showVarPos;
int32 varNo;
int32 *varTable;
// clear the array of text block numbers for the debug text
Clear_debug_text_blocks();
Clear_debug_text_blocks(); // clear the array of text block numbers for the debug text
//-------------------------------------------------------------------
// mouse coords
/*
if (displayMouseMarker) // print mouse coords beside mouse-marker, if it's being displayed
{
sprintf (buf, "%d,%d", mousex+this_screen.scroll_offset_x, mousey+this_screen.scroll_offset_y);
// print mouse coords beside mouse-marker, if it's being displayed
if (displayMouseMarker) {
sprintf(buf, "%d,%d", mousex + this_screen.scroll_offset_x, mousey + this_screen.scroll_offset_y);
if (mousex>560)
Make_debug_text_block (buf, mousex-50, mousey-15);
Make_debug_text_block(buf, mousex - 50, mousey - 15);
else
Make_debug_text_block (buf, mousex+5, mousey-15);
Make_debug_text_block(buf, mousex + 5, mousey - 15);
}
*/
//-------------------------------------------------------------------
// mouse area coords
if (draggingRectangle || SYSTEM_TESTING_ANIMS) // defining a mouse area the easy way, by creating a box on-screen
{
rectFlicker = 1-rectFlicker; // so we can see what's behind the lines
// defining a mouse area the easy way, by creating a box on-screen
if (draggingRectangle || SYSTEM_TESTING_ANIMS) {
// so we can see what's behind the lines
rectFlicker = 1 - rectFlicker;
sprintf (buf, "x1=%d", rect_x1);
Make_debug_text_block (buf, 0, 120);
@ -261,47 +154,41 @@ void Build_debug_text( void ) // JAMES
sprintf (buf, "y2=%d", rect_y2);
Make_debug_text_block (buf, 0, 165);
}
//-------------------------------------------------------------------
// testingSnR indicator
if (testingSnR) // see FN_add_human()
{
if (testingSnR) { // see FN_add_human()
sprintf (buf, "TESTING LOGIC STABILITY!");
Make_debug_text_block (buf, 0, 105);
}
//---------------------------------------------
// speed-up indicator
if (renderSkip) // see sword.cpp
{
if (renderSkip) { // see sword.cpp
sprintf (buf, "SKIPPING FRAMES FOR SPEED-UP!");
Make_debug_text_block (buf, 0, 120);
}
//---------------------------------------------
// debug info at top of screen - enabled/disabled as one complete unit
if (displayTime)
{
if (displayTime) {
int32 time = timeGetTime();
if ((time - startTime) / 1000 >= 10000)
startTime = time;
time -= startTime;
sprintf(buf, "Time %.2d:%.2d:%.2d.%.3d",(time / 3600000) % 60,(time / 60000) % 60, (time / 1000) % 60,time%1000);
sprintf(buf, "Time %.2d:%.2d:%.2d.%.3d", (time / 3600000) % 60, (time / 60000) % 60, (time / 1000) % 60, time % 1000);
Make_debug_text_block(buf, 500, 360);
sprintf(buf, "Game %d", gameCycle);
Make_debug_text_block(buf, 500, 380);
}
//---------------------------------------------
// current text number & speech-sample resource id
if (displayTextNumbers)
{
if (textNumber)
{
if (SYSTEM_TESTING_TEXT)
{
if (displayTextNumbers) {
if (textNumber) {
if (SYSTEM_TESTING_TEXT) {
if (SYSTEM_WANT_PREVIOUS_LINE)
sprintf (buf, "backwards");
else
@ -318,133 +205,144 @@ void Build_debug_text( void ) // JAMES
sprintf (buf, "TEXT: %d", officialTextNumber);
Make_debug_text_block (buf, 0, 385);
}
}
//---------------------------------------------
// resource number currently being checking for animation
if (SYSTEM_TESTING_ANIMS)
{
if (SYSTEM_TESTING_ANIMS) {
sprintf (buf, "trying resource %d", SYSTEM_TESTING_ANIMS);
Make_debug_text_block (buf, 0, 90);
}
//---------------------------------------------
// general debug info
if (displayDebugText)
{
//---------------------------------------------
if (displayDebugText) {
/*
// CD in use
sprintf (buf, "CD-%d", currentCD);
Make_debug_text_block (buf, 0, 0);
*/
//---------------------------------------------
// mouse coords & object pointed to
if (CLICKED_ID)
sprintf (buf, "last click at %d,%d (id %d: %s)", MOUSE_X, MOUSE_Y, CLICKED_ID, FetchObjectName(CLICKED_ID));
sprintf(buf, "last click at %d,%d (id %d: %s)",
MOUSE_X, MOUSE_Y, CLICKED_ID,
FetchObjectName(CLICKED_ID));
else
sprintf (buf, "last click at %d,%d (---)", MOUSE_X, MOUSE_Y);
sprintf(buf, "last click at %d,%d (---)",
MOUSE_X, MOUSE_Y);
Make_debug_text_block (buf, 0, 15);
if (mouse_touching)
sprintf (buf, "mouse %d,%d (id %d: %s)", mousex+this_screen.scroll_offset_x, mousey+this_screen.scroll_offset_y, mouse_touching, FetchObjectName(mouse_touching));
sprintf(buf, "mouse %d,%d (id %d: %s)",
mousex + this_screen.scroll_offset_x,
mousey + this_screen.scroll_offset_y,
mouse_touching,
FetchObjectName(mouse_touching));
else
sprintf (buf, "mouse %d,%d (not touching)", mousex+this_screen.scroll_offset_x, mousey+this_screen.scroll_offset_y);
sprintf(buf, "mouse %d,%d (not touching)",
mousex + this_screen.scroll_offset_x,
mousey + this_screen.scroll_offset_y);
Make_debug_text_block (buf, 0, 30);
//---------------------------------------------
// player coords & graphic info
// if player objct has a graphic
if (playerGraphic.anim_resource) // if player objct has a graphic
sprintf (buf, "player %d,%d %s (%d) #%d/%d", this_screen.player_feet_x, this_screen.player_feet_y, FetchObjectName(playerGraphic.anim_resource), playerGraphic.anim_resource, playerGraphic.anim_pc, player_graphic_no_frames);
if (playerGraphic.anim_resource)
sprintf(buf, "player %d,%d %s (%d) #%d/%d",
this_screen.player_feet_x,
this_screen.player_feet_y,
FetchObjectName(playerGraphic.anim_resource),
playerGraphic.anim_resource,
playerGraphic.anim_pc,
player_graphic_no_frames);
else
sprintf (buf, "player %d,%d --- %d", this_screen.player_feet_x, this_screen.player_feet_y, playerGraphic.anim_pc);
sprintf(buf, "player %d,%d --- %d",
this_screen.player_feet_x,
this_screen.player_feet_y,
playerGraphic.anim_pc);
Make_debug_text_block (buf, 0, 45);
//---------------------------------------------
// frames-per-second counter
sprintf (buf, "fps %d", fps);
sprintf(buf, "fps %d", fps);
Make_debug_text_block (buf, 440, 0);
//---------------------------------------------
// location number
sprintf (buf, "location=%d", LOCATION);
sprintf(buf, "location=%d", LOCATION);
Make_debug_text_block (buf, 440, 15);
//---------------------------------------------
// "result" variable
sprintf (buf, "result=%d", RESULT);
sprintf(buf, "result=%d", RESULT);
Make_debug_text_block (buf, 440, 30);
//---------------------------------------------
// no. of events in event list
sprintf (buf, "events=%d", CountEvents());
sprintf(buf, "events=%d", CountEvents());
Make_debug_text_block (buf, 440, 45);
//---------------------------------------------
// sprite list usage
sprintf (buf, "bgp0: %d/%d",cur_bgp0,MAX_bgp0_sprites);
sprintf(buf, "bgp0: %d/%d", cur_bgp0, MAX_bgp0_sprites);
Make_debug_text_block (buf, 560, 0);
sprintf (buf, "bgp1: %d/%d",cur_bgp1,MAX_bgp1_sprites);
sprintf(buf, "bgp1: %d/%d", cur_bgp1, MAX_bgp1_sprites);
Make_debug_text_block (buf, 560, 15);
sprintf (buf, "back: %d/%d",cur_back,MAX_back_sprites);
sprintf(buf, "back: %d/%d", cur_back, MAX_back_sprites);
Make_debug_text_block (buf, 560, 30);
sprintf (buf, "sort: %d/%d",cur_sort,MAX_sort_sprites);
sprintf(buf, "sort: %d/%d", cur_sort, MAX_sort_sprites);
Make_debug_text_block (buf, 560, 45);
sprintf (buf, "fore: %d/%d",cur_fore,MAX_fore_sprites);
sprintf(buf, "fore: %d/%d", cur_fore, MAX_fore_sprites);
Make_debug_text_block (buf, 560, 60);
sprintf (buf, "fgp0: %d/%d",cur_fgp0,MAX_fgp0_sprites);
sprintf(buf, "fgp0: %d/%d", cur_fgp0, MAX_fgp0_sprites);
Make_debug_text_block (buf, 560, 75);
sprintf (buf, "fgp1: %d/%d",cur_fgp1,MAX_fgp1_sprites);
sprintf(buf, "fgp1: %d/%d", cur_fgp1, MAX_fgp1_sprites);
Make_debug_text_block (buf, 560, 90);
//---------------------------------------------
// largest layer & sprite
// NB. Strings already constructed in Build_display.cpp
Make_debug_text_block (largest_layer_info, 0, 60);
Make_debug_text_block (largest_sprite_info, 0, 75);
//---------------------------------------------
// "waiting for person" indicator - set form FN_they_do & FN_they_do_we_wait
// "waiting for person" indicator - set form FN_they_do &
// FN_they_do_we_wait
if (speechScriptWaiting)
{
sprintf (buf, "script waiting for %s (%d)", FetchObjectName(speechScriptWaiting), speechScriptWaiting);
if (speechScriptWaiting) {
sprintf(buf, "script waiting for %s (%d)",
FetchObjectName(speechScriptWaiting),
speechScriptWaiting);
Make_debug_text_block (buf, 0, 90);
}
//---------------------------------------------
// variable watch display
showVarPos = 115; // y-coord for first showVar
varTable = (int32*)(res_man.Res_open(1) + sizeof(_standardHeader)); // res 1 is the global variables resource
// res 1 is the global variables resource
varTable = (int32 *) (res_man.Res_open(1) + sizeof(_standardHeader));
for (showVarNo=0; showVarNo < MAX_SHOWVARS; showVarNo++)
{
for (showVarNo = 0; showVarNo < MAX_SHOWVARS; showVarNo++) {
varNo = showVar[showVarNo]; // get variable number
if (varNo) // if non-zero ie. cannot watch 'id' but not needed anyway because it changes throughout the logic loop
{
sprintf (buf, "var(%d) = %d", varNo, varTable[varNo]);
// if non-zero ie. cannot watch 'id' but not needed
// anyway because it changes throughout the logic loop
if (varNo) {
sprintf(buf, "var(%d) = %d",
varNo, varTable[varNo]);
Make_debug_text_block (buf, 530, showVarPos);
showVarPos += 15; // next line down
}
@ -452,98 +350,80 @@ void Build_debug_text( void ) // JAMES
res_man.Res_close(1); // close global variables resource
//---------------------------------------------
// memory indicator - this should come last, to show all the sprite blocks above!
// memory indicator - this should come last, to show all the
// sprite blocks above!
Create_mem_string (buf);
Make_debug_text_block (buf, 0, 0);
//---------------------------------------------
}
//-------------------------------------------------------------------
}
//--------------------------------------------------------------------------------------
void Draw_debug_graphics( void ) // JAMES (08apr97)
{
//-------------------------------
void Draw_debug_graphics(void) {
// walk-grid
if (displayWalkGrid)
PlotWalkGrid();
//-------------------------------
// player feet coord marker
if (displayPlayerMarker)
Plot_cross_hair (this_screen.player_feet_x, this_screen.player_feet_y, 215);
Plot_cross_hair(this_screen.player_feet_x, this_screen.player_feet_y, 215);
//-------------------------------------------------------------------
// mouse marker & coords
if (displayMouseMarker)
Plot_cross_hair (mousex+this_screen.scroll_offset_x, mousey+this_screen.scroll_offset_y, 215);
Plot_cross_hair(mousex + this_screen.scroll_offset_x, mousey + this_screen.scroll_offset_y, 215);
//-------------------------------------------------------------------
// mouse area rectangle / sprite box rectangle when testing anims
if (SYSTEM_TESTING_ANIMS)
{
DrawRect(rect_x1, rect_y1, rect_x2, rect_y2, 184); // draw box around current frame
}
else if (draggingRectangle) // defining a mouse area the easy way, by creating a box on-screen
{
if (SYSTEM_TESTING_ANIMS) {
// draw box around current frame
DrawRect(rect_x1, rect_y1, rect_x2, rect_y2, 184);
} else if (draggingRectangle) {
// defining a mouse area the easy way, by creating a box
// on-screen
if (rectFlicker)
DrawRect(rect_x1, rect_y1, rect_x2, rect_y2, 184);
}
//-------------------------------------------------------------------
}
//--------------------------------------------------------------------------------------
void Plot_cross_hair( int16 x, int16 y, uint8 pen )
{
PlotPoint(x,y,pen); // driver function
DrawLine(x-2,y,x-5,y,pen); // driver function
DrawLine(x+2,y,x+5,y,pen);
void Plot_cross_hair(int16 x, int16 y, uint8 pen) {
PlotPoint(x, y, pen); // driver function
DrawLine(x,y-2,x,y-5,pen);
DrawLine(x,y+2,x,y+5,pen);
DrawLine(x - 2, y, x - 5, y, pen); // driver function
DrawLine(x + 2, y, x + 5, y, pen);
DrawLine(x, y - 2, x, y - 5, pen);
DrawLine(x, y + 2, x, y + 5, pen);
}
//--------------------------------------------------------------------------------------
void DrawRect( int16 x1, int16 y1, int16 x2, int16 y2, uint8 pen )
{
DrawLine(x1,y1,x2,y1,pen); // top edge
DrawLine(x1,y2,x2,y2,pen); // bottom edge
DrawLine(x1,y1,x1,y2,pen); // left edge
DrawLine(x2,y1,x2,y2,pen); // right edge
void DrawRect(int16 x1, int16 y1, int16 x2, int16 y2, uint8 pen) {
DrawLine(x1, y1, x2, y1, pen); // top edge
DrawLine(x1, y2, x2, y2, pen); // bottom edge
DrawLine(x1, y1, x1, y2, pen); // left edge
DrawLine(x2, y1, x2, y2, pen); // right edge
}
//--------------------------------------------------------------------------------------
void Print_current_info(void) //Tony30Oct96
{
//prints general stuff about the screen, etc.
void Print_current_info(void) {
// prints general stuff about the screen, etc.
if (this_screen.background_layer_id)
{ Print_to_console(" background layer id %d", this_screen.background_layer_id);
Print_to_console(" %d wide, %d high", this_screen.screen_wide, this_screen.screen_deep);
Print_to_console(" %d normal layers", this_screen.number_of_layers);
if (this_screen.background_layer_id) {
Print_to_console(" background layer id %d",
this_screen.background_layer_id);
Print_to_console(" %d wide, %d high",
this_screen.screen_wide, this_screen.screen_deep);
Print_to_console(" %d normal layers",
this_screen.number_of_layers);
LLogic.Examine_run_list();
}
else
} else
Print_to_console(" no screen");
Scroll_console();
}
//--------------------------------------------------------------------------------------
#else // not debug
#else
void Draw_debug_graphics(void) {}
#endif // _SWORD2_DEBUG
//--------------------------------------------------------------------------------------
#endif

View File

@ -20,33 +20,31 @@
#ifndef D_DEBUG
#define D_DEBUG
//--------------------------------------------------------------------------------------
#ifdef _SWORD2_DEBUG // this whole file only included on debug versions
// this whole file only included on debug versions
#ifdef _SWORD2_DEBUG
//#include "src\driver96.h"
#include "driver.h"
#include "object.h"
#define MAX_DEBUG_TEXT_BLOCKS 50
extern uint8 displayDebugText; // 0=off; 1=on
extern uint8 displayWalkGrid;
extern uint8 displayMouseMarker;
extern uint8 displayPlayerMarker;
extern uint8 displayTime;
extern uint8 displayTextNumbers;
extern uint8 definingRectangles;
extern uint8 draggingRectangle;
extern uint8 displayTime;
extern int32 startTime;
extern int32 gameCycle;
extern uint8 renderSkip;
extern uint8 displayDebugText; // 0=off; 1=on
extern uint8 displayWalkGrid;
extern uint8 displayMouseMarker;
extern uint8 displayPlayerMarker;
extern uint8 displayTime;
extern uint8 displayTextNumbers;
extern uint8 definingRectangles;
extern uint8 draggingRectangle;
extern uint8 displayTime;
extern int32 startTime;
extern int32 gameCycle;
extern uint8 renderSkip;
extern int16 rect_x1;
extern int16 rect_y1;
extern int16 rect_x2;
extern int16 rect_y2;
extern int16 rect_x1;
extern int16 rect_y1;
extern int16 rect_x2;
extern int16 rect_y2;
extern uint8 testingSnR;
@ -55,38 +53,20 @@ extern int32 textNumber;
extern Object_graphic playerGraphic;
extern uint32 player_graphic_no_frames;
#define MAX_SHOWVARS 15
extern int32 showVar[MAX_SHOWVARS];
extern int32 showVar[MAX_SHOWVARS];
void Zdebug(const char * ,...); // Tony's special debug logging file March96
void Zdebug(uint32 stream, const char *format,...);
void Build_debug_text(void); // James's debug text display
void Draw_debug_graphics(void); // James's debug graphics display
void Print_current_info(void); //Tony30Oct96
void Build_debug_text(void);
void Draw_debug_graphics(void);
void Print_current_info(void);
#else // ie. not _SWORD2_DEBUG
/* gcc doesn't like this - khalek
#define Zdebug NULL
#define Build_debug_text NULL
#define Draw_debug_graphics NULL
#define Print_current_info NULL
*/
void Build_debug_text(void);
void Draw_debug_graphics(void);
void Zdebug(const char * ,...); // Tony's special debug logging file March96
void Build_debug_text(void); // James's debug text display
void Draw_debug_graphics(void); // James's debug graphics display
#endif
#endif // _SWORD2_DEBUG // this whole file only included on debug versions
//--------------------------------------------------------------------------------------
void ExitWithReport(const char *format,...); // (6dec96 JEL) IN BOTH DEBUG & RELEASE VERSIONS
#endif //D_DEBUG
#endif

View File

@ -64,89 +64,79 @@
//
//=============================================================================
//#include "ddraw.h"
#include "stdafx.h"
#include "driver96.h"
#include "d_draw.h"
#include "render.h"
#include "menu.h"
#include "../sword2.h"
#define MAX_MOUSE_EVENTS 16
#define MOUSEFLASHFRAME 6
// FIXME: Does this struct have to be packed?
#if !defined(__GNUC__)
#pragma START_PACK_STRUCTS
#endif
typedef struct {
uint8 runTimeComp; // type of runtime compression used for the frame data
uint8 noAnimFrames; // number of frames in the anim
int8 xHotSpot;
int8 yHotSpot;
uint8 mousew;
uint8 mouseh;
} _mouseAnim;
uint8 runTimeComp; // type of runtime compression used for the
// frame data
uint8 noAnimFrames; // number of frames in the anim
int8 xHotSpot;
int8 yHotSpot;
uint8 mousew;
uint8 mouseh;
} GCC_PACK _mouseAnim;
int16 mousex;
int16 mousey;
#if !defined(__GNUC__)
#pragma END_PACK_STRUCTS
#endif
static uint8 mouseBacklog = 0;
static uint8 mouseLogPos = 0;
static uint8 mouseFrame;
static uint8 *mouseSprite = NULL;
static _mouseAnim *mouseAnim = NULL;
static _mouseAnim *luggageAnim = NULL;
static _mouseEvent mouseLog[MAX_MOUSE_EVENTS];
static int32 *mouseOffsets;
static int32 *luggageOffset;
// FIXME: I have no idea how large the mouse cursor can be. Is this enough?
byte _mouseData[128 * 128];
int16 mousex;
int16 mousey;
static uint8 mouseBacklog = 0;
static uint8 mouseLogPos = 0;
static uint8 mouseFrame;
static uint8 *mouseSprite = NULL;
static _mouseAnim *mouseAnim = NULL;
static _mouseAnim *luggageAnim = NULL;
static _mouseEvent mouseLog[MAX_MOUSE_EVENTS];
static int32 *mouseOffsets;
static int32 *luggageOffset;
// This is the maximum mouse cursor size in the SDL backend
#define MAX_MOUSE_W 80
#define MAX_MOUSE_H 80
byte _mouseData[MAX_MOUSE_W * MAX_MOUSE_H];
void ResetRenderEngine(void) {
parallaxScrollx = 0;
parallaxScrolly = 0;
scrollx = 0;
scrolly = 0;
}
// --------------------------------------------------------------------------
// Logs the mouse button event passed in buttons. The button events are
// defined as RD_LEFTBUTTONDOWN, RD_LEFTBUTTONUP, RD_RIGHTBUTTONDOWN and
// RD_RIGHTBUTTONUP.
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Logs the mouse button event passed in buttons. The button events are
// defined as RD_LEFTBUTTONDOWN, RD_LEFTBUTTONUP, RD_RIGHTBUTTONDOWN and
// RD_RIGHTBUTTONUP.
// --------------------------------------------------------------------------
void LogMouseEvent(uint16 buttons)
{
void LogMouseEvent(uint16 buttons) {
_mouseEvent *me;
if (mouseBacklog == MAX_MOUSE_EVENTS-1) // We need to leave the one which is
{ // the current event alone!
// We need to leave the one, which is the current event, alone!
if (mouseBacklog == MAX_MOUSE_EVENTS - 1)
return;
}
me = &mouseLog[(mouseBacklog + mouseLogPos) % MAX_MOUSE_EVENTS];
me->buttons = buttons;
mouseBacklog += 1;
mouseBacklog++;
}
// FIXME: The original code used 0 for transparency, while our backend uses
// 0xFF. That means that parts of the mouse cursor that weren't meant to be
// transparent may be now.
@ -174,11 +164,10 @@ int32 DecompressMouse(uint8 *decomp, uint8 *comp, int width, int height, int pit
i += *comp++;
}
}
return RD_OK;
}
void DrawMouse(void) {
if (!mouseAnim && !luggageAnim)
return;
@ -222,16 +211,18 @@ void DrawMouse(void) {
assert(deltaX >= 0);
assert(deltaY >= 0);
// HACK for maximum cursor size
if (mouse_width + deltaX > 80)
// HACK for maximum cursor size. (The SDL backend imposes this
// restriction)
if (mouse_width + deltaX > MAX_MOUSE_W)
deltaX = 80 - mouse_width;
if (mouse_height + deltaY > 80)
if (mouse_height + deltaY > MAX_MOUSE_H)
deltaY = 80 - mouse_height;
mouse_width += deltaX;
mouse_height += deltaY;
if ((uint32)(mouse_width * mouse_height) > sizeof(_mouseData)) {
if ((uint32) (mouse_width * mouse_height) > sizeof(_mouseData)) {
warning("Mouse cursor too large");
return;
}
@ -239,7 +230,7 @@ void DrawMouse(void) {
memset(_mouseData, 0xFF, mouse_width * mouse_height);
if (luggageAnim)
DecompressMouse(_mouseData, (uint8 *) luggageAnim + (int32)READ_LE_UINT32(luggageOffset), luggageAnim->mousew,
DecompressMouse(_mouseData, (uint8 *) luggageAnim + READ_LE_UINT32(luggageOffset), luggageAnim->mousew,
luggageAnim->mouseh, mouse_width, deltaX, deltaY);
if (mouseAnim)
@ -248,35 +239,25 @@ void DrawMouse(void) {
g_system->set_mouse_cursor(_mouseData, mouse_width, mouse_height, hotspot_x, hotspot_y);
}
_mouseEvent *MouseEvent(void)
{
_mouseEvent *MouseEvent(void) {
_mouseEvent *me;
if (mouseBacklog)
{
if (mouseBacklog) {
me = &mouseLog[mouseLogPos];
if (++mouseLogPos == MAX_MOUSE_EVENTS)
{
mouseLogPos = 0;
}
mouseBacklog -= 1;
return(me);
mouseBacklog--;
return me;
}
return(NULL);
return NULL;
}
uint8 CheckForMouseEvents(void) // (James23july97)
{
return (mouseBacklog); // return the number of mouse events waiting
uint8 CheckForMouseEvents(void) {
return mouseBacklog; // return the number of mouse events waiting
}
int32 AnimateMouse(void) {
uint8 prevMouseFrame = mouseFrame;
@ -285,7 +266,8 @@ int32 AnimateMouse(void) {
if (++mouseFrame == mouseAnim->noAnimFrames)
mouseFrame = MOUSEFLASHFRAME;
mouseSprite = (uint8 *) mouseAnim + (int32)READ_LE_UINT32(mouseOffsets + mouseFrame);
mouseSprite = (uint8 *) mouseAnim + READ_LE_UINT32(mouseOffsets + mouseFrame);
if (mouseFrame != prevMouseFrame)
DrawMouse();
@ -293,18 +275,18 @@ int32 AnimateMouse(void) {
return RD_OK;
}
int32 SetMouseAnim(uint8 *ma, int32 size, int32 mouseFlash) {
if (mouseAnim) {
free(mouseAnim);
mouseAnim = NULL;
}
if (ma) {
if (mouseFlash == RDMOUSE_FLASH)
mouseFrame = 0;
else
mouseFrame = MOUSEFLASHFRAME;
mouseAnim = (_mouseAnim *) malloc(size);
if (!mouseAnim)
return RDERR_OUTOFMEMORY;
@ -322,15 +304,16 @@ int32 SetMouseAnim(uint8 *ma, int32 size, int32 mouseFlash) {
else
g_system->show_mouse(false);
}
return RD_OK;
}
int32 SetLuggageAnim(uint8 *ma, int32 size) {
if (luggageAnim) {
free(luggageAnim);
luggageAnim = NULL;
}
if (ma) {
luggageAnim = (_mouseAnim *) malloc(size);
if (!luggageAnim)
@ -349,7 +332,6 @@ int32 SetLuggageAnim(uint8 *ma, int32 size) {
else
g_system->show_mouse(false);
}
return RD_OK;
}

View File

@ -37,7 +37,7 @@
#define MENUDEEP 40 // Temporary, until menu.h is written!
#if 0
//-----------------------------------------------------------------------------
void Zdebug(const char *format,...) {
@ -68,6 +68,7 @@ void Zdebug(const char *format,...) {
#endif
#endif
}
#endif
//-----------------------------------------------------------------------------
// OSystem Event Handler. Full of cross platform goodness and 99% fat free!

View File

@ -17,30 +17,9 @@
* $Header$
*/
//=============================================================================
//
// Filename : rdwin.h
// Created : 20th August 1996
// By : P.R.Porter
//
// Summary : This include file defines links to all data which is
// defined in the rdwin.c module, but can be accessed by
// other parts of the driver96 library.
//
//
//=============================================================================
#ifndef RDWIN_H
#define RDWIN_H
/*
extern HWND hwnd; // handle to the current window
extern RECT rcWindow; // size of the current window.
extern void Message(LPSTR fmt, ...);
*/
extern void SetNeedRedraw(void);
#endif

View File

@ -68,7 +68,7 @@ int32 FN_request_speech(int32 *params) {
}
if (j == MAX_events)
Con_fatal_error("FN_set_event out of event slots (%s line %u)", __FILE__, __LINE__);
Con_fatal_error("FN_set_event out of event slots");
//found that slot
@ -159,7 +159,7 @@ int32 FN_send_event(int32 *params) {
uint32 j = 0;
// Zdebug("*+*+* %d %d", params[0], params[1]);
debug(5, "FN_send_event(%d, %d)", params[0], params[1]);
// search for an existing event or a slot

View File

@ -39,14 +39,14 @@ Object_mega engine_mega; // global for engine
int32 FN_test_function(int32 *params) {
// param 0 address of a flag
Zdebug(" TEST %d %d", params[0], RESULT);
debug(5, " TEST %d %d", params[0], RESULT);
return IR_CONT;
}
int32 FN_test_flags(int32 *params) {
// param 0 value of flag
// Zdebug("\nFN_test_flags %d, %d\n", params[0], params[1]);
debug(5, "FN_test_flags %d, %d\n", params[0], params[1]);
return IR_CONT;
}
@ -65,7 +65,7 @@ int32 FN_new_script(int32 *params) {
// directive
// param 0 id of script
Zdebug("FN_new_script %d", params[0]);
debug(5, "FN_new_script %d", params[0]);
// must clear this
PLAYER_ACTION = 0;
@ -82,7 +82,7 @@ int32 FN_interact(int32 *params) {
// param 0 id of target from which we derive action script
// reference
Zdebug("FN_interact %d", params[0]);
debug(5, "FN_interact %d", params[0]);
// must clear this
PLAYER_ACTION = 0;
@ -354,7 +354,7 @@ int32 FN_reset_globals(int32 *params) {
size = res_man.Res_fetch_len(1);
size -= sizeof(_standardHeader);
Zdebug("\nglobals size %d", size / 4);
debug(5, "globals size %d", size / 4);
globals = (uint32*) ((uint8 *) res_man.Res_open(1) + sizeof(_standardHeader));

View File

@ -33,11 +33,11 @@ uint32 total_masters=0;
int32 FN_add_menu_object(int32 *params) {
// param 0 pointer to a menu_object structure to copy down
// Zdebug("FN_add_menu_object icon res");
debug(5, "FN_add_menu_object icon res");
#ifdef _SWORD2_DEBUG
if (total_temp == TOTAL_engine_pockets)
Con_fatal_error("TOTAL_engine_pockets exceeded! (%s line %u)", __FILE__, __LINE__);
Con_fatal_error("TOTAL_engine_pockets exceeded!");
#endif
// copy the structure to our in-the-engine list
@ -81,7 +81,7 @@ void Build_top_menu(void) {
// reset temp list which will be totally rebuilt
total_temp = 0;
// Zdebug("\nbuild top menu %d", total_masters);
debug(5, "build top menu %d", total_masters);
// clear the temp list before building a new temp list in-case list
// gets smaller. check each master
@ -116,7 +116,7 @@ void Build_top_menu(void) {
if (!res) {
// otherwise not in temp so kill in main
master_menu_list[j].icon_resource = 0;
// Zdebug("Killed menu %d",j);
debug(5, "Killed menu %d", j);
}
}
}
@ -209,7 +209,7 @@ void Build_top_menu(void) {
} else {
// no icon here
SetMenuIcon(RDMENU_BOTTOM, j, NULL);
// Zdebug(" NULL for %d", j);
debug(5, " NULL for %d", j);
}
}

View File

@ -280,7 +280,7 @@ int32 (*McodeTable[MAX_FN_NUMBER + 1]) (int32 *) = {
FN_change_shadows,
};
#define CHECKSTACKPOINTER2 ASSERT(stackPointer2 >= 0 && stackPointer2 < STACK_SIZE);
#define CHECKSTACKPOINTER2 assert(stackPointer2 >= 0 && stackPointer2 < STACK_SIZE);
#define PUSHONSTACK(x) { stack2[stackPointer2] = (x); stackPointer2++; CHECKSTACKPOINTER2 }
#define POPOFFSTACK(x) { x = stack2[stackPointer2 - 1]; stackPointer2--; CHECKSTACKPOINTER2 }
#define DOOPERATION(x) { stack2[stackPointer2 - 2] = (x); stackPointer2--; CHECKSTACKPOINTER2 }
@ -317,7 +317,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
const char *tempScrPtr;
// Get the start of variables and start of code
DEBUG("Enter interpreter data %x, object %x, offset %d", scriptData, objectData, *offset);
debug(5, "Enter interpreter data %x, object %x, offset %d", scriptData, objectData, *offset);
// FIXME: 'scriptData' and 'variables' used to be const. However,
// this code writes into 'variables' so it can not be const.
@ -328,10 +328,10 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
if (*offset < noScripts) {
ip = READ_LE_UINT32((const int *) code + *offset + 1);
DEBUG("Start script %d with offset %d",*offset,ip);
debug(5, "Start script %d with offset %d",*offset,ip);
} else {
ip = *offset;
DEBUG("Start script with offset %d",ip);
debug(5, "Start script with offset %d",ip);
}
code += noScripts * sizeof(int) + sizeof(int);
@ -368,36 +368,36 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
switch (curCommand) {
case CP_END_SCRIPT:
// End the script
DEBUG("End script",0);
debug(5, "End script",0);
runningScript = 0;
break;
case CP_PUSH_LOCAL_VAR32:
// Push the contents of a local variable
Read16ip(parameter);
DEBUG("Push local var %d (%d)", parameter, *(int32 *) (variables + parameter));
debug(5, "Push local var %d (%d)", parameter, *(int32 *) (variables + parameter));
PUSHONSTACK(*(int32 *) (variables + parameter));
break;
case CP_PUSH_GLOBAL_VAR32:
// Push a global variable
Read16ip(parameter);
DEBUG("Push global var %d (%d)", parameter, globalInterpreterVariables2[parameter]);
ASSERT(globalInterpreterVariables2);
debug(5, "Push global var %d (%d)", parameter, globalInterpreterVariables2[parameter]);
assert(globalInterpreterVariables2);
PUSHONSTACK(globalInterpreterVariables2[parameter]);
break;
case CP_POP_LOCAL_VAR32:
// Pop a value into a local word variable
Read16ip(parameter);
POPOFFSTACK(value);
DEBUG("Pop %d into var %d", value, parameter);
debug(5, "Pop %d into var %d", value, parameter);
*((int32 *) (variables + parameter)) = value;
break;
case CP_CALL_MCODE:
// Call an mcode routine
Read16ip(parameter);
ASSERT(parameter <= MAX_FN_NUMBER);
assert(parameter <= MAX_FN_NUMBER);
// amount to adjust stack by (no of parameters)
Read8ip(value);
DEBUG("Call mcode %d with stack = %x", parameter, stack2 + stackPointer2 - value);
debug(5, "Call mcode %d with stack = %x", parameter, stack2 + stackPointer2 - value);
retVal = McodeTable[parameter](stack2 + stackPointer2 - value);
stackPointer2 -= value;
CHECKSTACKPOINTER2
@ -424,27 +424,27 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
*offset = ip;
return 2;
default:
ASSERT(false);
assert(false);
}
parameterReturnedFromMcodeFunction = retVal >> 3;
break;
case CP_PUSH_LOCAL_ADDR:
// push the address of a local variable
Read16ip(parameter);
DEBUG("Push address of local variable %d (%x)", parameter, (int32) (variables + parameter));
debug(5, "Push address of local variable %d (%x)", parameter, (int32) (variables + parameter));
PUSHONSTACK((int32) (variables + parameter));
break;
case CP_PUSH_INT32:
// Push a long word value on to the stack
Read32ip(parameter);
DEBUG("Push int32 %d (%x)", parameter, parameter);
debug(5, "Push int32 %d (%x)", parameter, parameter);
PUSHONSTACK(parameter);
break;
case CP_SKIPONFALSE:
// Skip if the value on the stack is false
Read32ipLeaveip(parameter);
POPOFFSTACK(value);
DEBUG("Skip %d if %d is false", parameter, value);
debug(5, "Skip %d if %d is false", parameter, value);
if (value)
ip += sizeof(int32);
else
@ -453,7 +453,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
case CP_SKIPALWAYS:
// skip a block
Read32ipLeaveip(parameter);
DEBUG("Skip %d", parameter);
debug(5, "Skip %d", parameter);
ip += parameter;
break;
case CP_SWITCH:
@ -484,19 +484,19 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
Read16ip(parameter);
POPOFFSTACK(value);
*((int32 *) (variables + parameter)) += value;
DEBUG("+= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
debug(5, "+= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
break;
case CP_SUBNPOP_LOCAL_VAR32:
Read16ip(parameter);
POPOFFSTACK(value);
*((int32 *) (variables + parameter)) -= value;
DEBUG("-= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
debug(5, "-= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
break;
case CP_SKIPONTRUE:
// Skip if the value on the stack is TRUE
Read32ipLeaveip(parameter);
POPOFFSTACK(value);
DEBUG("Skip %d if %d is false", parameter, value);
debug(5, "Skip %d if %d is false", parameter, value);
if (!value)
ip += sizeof(int32);
else
@ -506,7 +506,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
// Pop a global variable
Read16ip(parameter);
POPOFFSTACK(value);
DEBUG("Pop %d into global var %d", value, parameter);
debug(5, "Pop %d into global var %d", value, parameter);
#ifdef TRACEGLOBALVARIABLESET
TRACEGLOBALVARIABLESET(parameter, value);
@ -521,14 +521,14 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
// ip += 2;
POPOFFSTACK(value);
globalInterpreterVariables2[parameter] += value;
DEBUG("+= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
debug(5, "+= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
break;
case CP_SUBNPOP_GLOBAL_VAR32:
// Sub and pop a global variable
Read16ip(parameter);
POPOFFSTACK(value);
globalInterpreterVariables2[parameter] -= value;
DEBUG("-= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
debug(5, "-= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
break;
case CP_DEBUGON:
// Turn debugging on
@ -551,7 +551,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
case OP_ISEQUAL:
// '=='
DEBUG("%d == %d -> %d",
debug(5, "%d == %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] == stack2[stackPointer2 - 1]);
@ -559,7 +559,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_PLUS:
// '+'
DEBUG("%d + %d -> %d",
debug(5, "%d + %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] + stack2[stackPointer2 - 1]);
@ -567,7 +567,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_MINUS:
// '-'
DEBUG("%d - %d -> %d",
debug(5, "%d - %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] - stack2[stackPointer2 - 1]);
@ -575,7 +575,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_TIMES:
// '*'
DEBUG("%d * %d -> %d",
debug(5, "%d * %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] * stack2[stackPointer2 - 1]);
@ -583,7 +583,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_DIVIDE:
// '/'
DEBUG("%d / %d -> %d",
debug(5, "%d / %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] / stack2[stackPointer2 - 1]);
@ -591,7 +591,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_NOTEQUAL:
// '!='
DEBUG("%d != %d -> %d",
debug(5, "%d != %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] != stack2[stackPointer2 - 1]);
@ -599,7 +599,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_ANDAND:
// '&&'
DEBUG("%d != %d -> %d",
debug(5, "%d != %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] && stack2[stackPointer2 - 1]);
@ -607,7 +607,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_GTTHAN:
// '>'
DEBUG("%d > %d -> %d",
debug(5, "%d > %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] > stack2[stackPointer2 - 1]);
@ -615,7 +615,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_LSTHAN:
// '<'
DEBUG("%d < %d -> %d",
debug(5, "%d < %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] < stack2[stackPointer2 - 1]);
@ -633,7 +633,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
// Process a text line
// This was apparently used in Linc
Read32ip(parameter);
DEBUG("Process text id %d", parameter);
debug(5, "Process text id %d", parameter);
break;
case CP_SAVE_MCODE_START:
// Save the start position on an mcode instruction in
@ -675,12 +675,12 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
case CP_PUSH_DEREFERENCED_STRUCTURE:
// Push the address of a dereferenced structure
Read32ip(parameter);
DEBUG("Push address of far variable (%x)", (int32) (variables + parameter));
debug(5, "Push address of far variable (%x)", (int32) (variables + parameter));
PUSHONSTACK((int) (objectData + sizeof(int) + sizeof(_standardHeader) + sizeof(_object_hub) + parameter));
break;
case OP_GTTHANE:
// '>='
DEBUG("%d > %d -> %d",
debug(5, "%d > %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] >= stack2[stackPointer2 - 1]);
@ -688,7 +688,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_LSTHANE:
// '<='
DEBUG("%d < %d -> %d",
debug(5, "%d < %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] <= stack2[stackPointer2 - 1]);
@ -696,7 +696,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
break;
case OP_OROR:
// '||'
DEBUG("%d || %d -> %d",
debug(5, "%d || %d -> %d",
stack2[stackPointer2 - 2],
stack2[stackPointer2 - 1],
stack2[stackPointer2 - 2] || stack2[stackPointer2 - 1]);

View File

@ -31,10 +31,6 @@
#define IR_REPEAT 3
#define IR_GOSUB 4
#define DEBUG if (g_debugFlag) Zdebug
#define ASSERT(x) { if (!(x)) { Zdebug("Interpreter ASSERT %s,%d", __FILE__, __LINE__); Con_fatal_error("Assert error in interpreter"); } }
// Get parameter fix so that the playstation version can handle words not on
// word boundaries

View File

@ -52,28 +52,16 @@ int32 FN_init_background(int32 *params) {
uint8 *file;
uint32 rv;
#ifdef _SWORD2_DEBUG
//--------------------------------------
// Write to walkthrough file (zebug0.txt)
Zdebug(0,"=====================================");
Zdebug(0,"CHANGED TO LOCATION \"%s\"", FetchObjectName(*params));
Zdebug(0,"=====================================");
// Also write this to system debug file
Zdebug("=====================================");
Zdebug("CHANGED TO LOCATION \"%s\"", FetchObjectName(*params));
Zdebug("=====================================");
//--------------------------------------
#endif
debug(5, "CHANGED TO LOCATION \"%s\"", FetchObjectName(*params));
// stop all fx & clears the queue
Clear_fx_queue();
#ifdef _SWORD2_DEBUG
Zdebug("FN_init_background(%d)", *params);
debug(5, "FN_init_background(%d)", *params);
if (!*params) {
Con_fatal_error("ERROR: FN_set_background cannot have 0 for background layer id! (%s line=%u)", __FILE__, __LINE__);
Con_fatal_error("ERROR: FN_set_background cannot have 0 for background layer id!");
}
#endif
@ -84,7 +72,7 @@ int32 FN_init_background(int32 *params) {
if (this_screen.mask_flag) {
rv = CloseLightMask();
if (rv)
ExitWithReport("Driver Error %.8x [%s line %u]", rv, __FILE__, __LINE__);
error("Driver Error %.8x", rv);
}
// New stuff for faster screen drivers
@ -110,7 +98,7 @@ int32 FN_init_background(int32 *params) {
this_screen.screen_wide = screen_head->width;
this_screen.screen_deep = screen_head->height;
Zdebug("res test layers=%d width=%d depth=%d", screen_head->noLayers, screen_head->width, screen_head->height);
debug(5, "res test layers=%d width=%d depth=%d", screen_head->noLayers, screen_head->width, screen_head->height);
//initialise the driver back buffer
SetLocationMetrics(screen_head->width, screen_head->height);
@ -128,7 +116,7 @@ int32 FN_init_background(int32 *params) {
// signifies a layer
sort_list[j].layer_number = j + 1;
Zdebug("init layer %d", j);
debug(5, "init layer %d", j);
}
}
@ -188,7 +176,7 @@ int32 FN_init_background(int32 *params) {
rv = OpenLightMask(&spriteInfo);
if (rv)
ExitWithReport("Driver Error %.8x [%s line %u]", rv, __FILE__, __LINE__);
error("Driver Error %.8x", rv);
// so we know to close it later! (see above)
this_screen.mask_flag = 1;
@ -202,7 +190,7 @@ int32 FN_init_background(int32 *params) {
SetUpBackgroundLayers();
Zdebug("end init");
debug(5, "end init");
return 1;
}

View File

@ -78,7 +78,7 @@ int logic::Process_session(void) {
res_man.Res_close(run_list);
// Zdebug("%d", ID);
debug(5, "%d", ID);
// null terminated
if (!ID) {
@ -93,10 +93,10 @@ int logic::Process_session(void) {
cur_object_hub = (_object_hub *) (head + 1);
// Zdebug(" %d id(%d) pc(%d)",
// cur_object_hub->logic_level,
// cur_object_hub->script_id[cur_object_hub->logic_level],
// cur_object_hub->script_pc[cur_object_hub->logic_level]);
debug(5, " %d id(%d) pc(%d)",
cur_object_hub->logic_level,
cur_object_hub->script_id[cur_object_hub->logic_level],
cur_object_hub->script_pc[cur_object_hub->logic_level]);
// do the logic for this object
// we keep going until a function says to stop - remember,
@ -113,9 +113,9 @@ int logic::Process_session(void) {
if (script / SIZE == ID) {
// its our script
// Zdebug("run script %d pc%d",
// script / SIZE,
// cur_object_hub->script_pc[LEVEL]);
debug(5, "run script %d pc%d",
script / SIZE,
cur_object_hub->script_pc[LEVEL]);
// this is the script data
// raw_script_ad = (char *) (cur_object_hub + 1);
@ -164,7 +164,7 @@ int logic::Process_session(void) {
// be different this time and simply
// let it restart next go :-)
// Zdebug("**WARNING object %d script 0 terminated!", id);
debug(5, "**WARNING object %d script 0 terminated!", id);
// reset to rerun
cur_object_hub->script_pc[LEVEL] = cur_object_hub->script_id[LEVEL] & 0xffff;
@ -173,7 +173,7 @@ int logic::Process_session(void) {
ret = 0;
}
} else if (ret > 2) {
Con_fatal_error("Process_session: illegal script return type %d (%s line %u)", ret, __FILE__, __LINE__);
Con_fatal_error("Process_session: illegal script return type %d", ret);
}
// if ret == 2 then we simply go around again - a new
@ -209,7 +209,7 @@ int logic::Process_session(void) {
// leaving a room so remove all ids that must reboot correctly
Process_kill_list();
Zdebug("RESTART the loop");
debug(5, "RESTART the loop");
// means restart the loop
return 1;
@ -297,9 +297,9 @@ void logic::Logic_up(uint32 new_script) {
if (cur_object_hub->logic_level == 3)
Con_fatal_error("Logic_up id %d has run off script tree! :-O", ID);
//setup new script on next level (not the current level)
// setup new script on next level (not the current level)
// Zdebug("new pc = %d", new_script & 0xffff);
debug(5, "new pc = %d", new_script & 0xffff);
cur_object_hub->script_id[cur_object_hub->logic_level] = new_script;
cur_object_hub->script_pc[cur_object_hub->logic_level] = new_script & 0xffff;
@ -422,7 +422,7 @@ int32 FN_add_to_kill_list(int32 *params) {
#ifdef _SWORD2_DEBUG
// no room at the inn
if (kills == OBJECT_KILL_LIST_SIZE)
Con_fatal_error("List full in FN_add_to_kill_list(%u) (%s line %u)", ID, __FILE__, __LINE__);
Con_fatal_error("List full in FN_add_to_kill_list(%u)", ID);
#endif
// add this 'ID' to the kill list

View File

@ -105,7 +105,7 @@ mem* MakeTextSprite(uint8 *sentence, uint16 maxWidth, uint8 pen, uint32 fontRes)
uint16 noOfLines; // no of lines of text required to fit within
// a sprite of width 'maxWidth' pixels
// Zdebug("MakeTextSprite(\"%s\", maxWidth=%u)", sentence, maxWidth);
debug(5, "MakeTextSprite(\"%s\", maxWidth=%u)", sentence, maxWidth);
// NB. ensure sentence contains no leading/tailing/extra spaces - if
// necessary, copy to another array first, missing the extra spaces.
@ -271,8 +271,8 @@ mem* BuildTextSprite(uint8 *sentence, uint32 fontRes, uint8 pen, _lineInfo *line
frameHeadPtr->width = spriteWidth;
frameHeadPtr->height = spriteHeight;
// Zdebug("spriteWidth=%u",spriteWidth);
// Zdebug("spriteHeight=%u",spriteHeight);
debug(5, "spriteWidth=%u", spriteWidth);
debug(5, "spriteHeight=%u", spriteHeight);
// ok, now point to the start (of the first line) of the sprite data
// itelf
@ -302,7 +302,7 @@ mem* BuildTextSprite(uint8 *sentence, uint32 fontRes, uint8 pen, _lineInfo *line
#ifdef _SWORD2_DEBUG
if (charPtr->height != charHeight)
Con_fatal_error("FONT ERROR: '%c' is not same height as the space (%s line %u)", sentence[pos - 1], __FILE__, __LINE__);
Con_fatal_error("FONT ERROR: '%c' is not same height as the space", sentence[pos - 1]);
#endif
CopyChar(charPtr, spritePtr, spriteWidth, pen);
@ -481,7 +481,7 @@ uint32 Build_new_block(uint8 *ascii, int16 x, int16 y, uint16 width, uint8 pen,
#ifdef _SWORD2_DEBUG
// we've run out - might as well stop the system
if (j == MAX_text_blocs)
Con_fatal_error("Build_new_block ran out of blocks! (%s line %u)", __FILE__, __LINE__);
Con_fatal_error("Build_new_block ran out of blocks!");
#endif
// make the sprite!
@ -590,7 +590,7 @@ void Print_text_blocs(void) {
rv = DrawSprite(&spriteInfo);
if (rv)
ExitWithReport("Driver Error %.8x in Print_text_blocs [%s line %u]", rv, __FILE__, __LINE__);
error("Driver Error %.8x in Print_text_blocs", rv);
}
}
}

View File

@ -20,7 +20,6 @@
#include "stdafx.h"
#include "build_display.h"
#include "console.h"
#include "debug.h"
#include "header.h"
#include "mem_view.h"
#include "memory.h"
@ -49,7 +48,7 @@ void Console_mem_display(void) {
// close immediately so give a true count
res_man.Res_close(mem_list[j].uid);
Zdebug("view %d", mem_list[j].uid);
debug(5, "view %d", mem_list[j].uid);
pass = 0;
found_end = 0;

View File

@ -38,6 +38,7 @@
// MemMan v1.1
#include "stdafx.h"
#include "driver/driver96.h"
#include "debug.h"
#include "memory.h"
#include "resman.h"
@ -79,8 +80,7 @@ void Init_memory_manager(void) {
memory_base = (uint8 *) malloc(total_free_memory);
if (!memory_base) { //could not grab the memory
Zdebug("couldn't malloc %d in Init_memory_manager", total_free_memory);
ExitWithReport("Init_memory_manager() couldn't malloc %d bytes [line=%d file=%s]", total_free_memory, __LINE__, __FILE__);
error("Init_memory_manager() couldn't malloc %d bytes", total_free_memory);
}
// the original malloc address
@ -206,7 +206,7 @@ mem *Talloc(uint32 size, uint32 type, uint32 unique_id) {
// up and we need to alert the developer
// Lets get a printout of this
Mem_debug();
ExitWithReport("ERROR: ran out of mem blocks in Talloc() [file=%s line=%u]", __FILE__, __LINE__);
error("Out of mem blocks in Talloc()");
}
mem_list[spawn].state = MEM_free; // new block is free
@ -462,14 +462,14 @@ void Mem_debug(void) {
{ "MEM_float" }
};
Zdebug("\nbase %d total %d", base_mem_block, total_blocks);
debug(5, "base %d total %d", base_mem_block, total_blocks);
// first in mem list order
for (j = 0; j < MAX_mem_blocks; j++) {
if (mem_list[j].state == MEM_null)
Zdebug("%d- NULL", j);
debug(5, "%d- NULL", j);
else
Zdebug("%d- state %s, ad %d, size %d, p %d, c %d, id %d",
debug(5, "%d- state %s, ad %d, size %d, p %d, c %d, id %d",
j, inf[mem_list[j].state], mem_list[j].ad,
mem_list[j].size, mem_list[j].parent,
mem_list[j].child, mem_list[j].uid);
@ -478,7 +478,7 @@ void Mem_debug(void) {
// now in child/parent order
j = base_mem_block;
do {
Zdebug(" %d- state %s, ad %d, size %d, p %d, c %d", j,
debug(5, " %d- state %s, ad %d, size %d, p %d, c %d", j,
inf[mem_list[j].state], mem_list[j].ad,
mem_list[j].size, mem_list[j].parent,
mem_list[j].child, mem_list[j].uid);
@ -499,16 +499,14 @@ mem *Twalloc(uint32 size, uint32 type, uint32 unique_id) {
while (VirtualDefrag(size)) {
// trash the oldest closed resource
if (!res_man.Help_the_aged_out()) {
Zdebug("Twalloc ran out of memory! %d %d %d\n", size, type, unique_id);
ExitWithReport("Twalloc ran out of memory!");
error("Twalloc ran out of memory: size=%d type=%d unique_id=%d", size, type, unique_id);
}
}
membloc = Talloc(size, type, unique_id);
if (membloc == 0) {
Zdebug("Talloc failed to get memory VirtualDefrag said was there");
ExitWithReport("Talloc failed to get memory VirtualDefrag said was there");
error("Talloc failed to get memory VirtualDefrag said was there");
}
j = base_mem_block;

View File

@ -22,7 +22,6 @@
#include "build_display.h"
#include "console.h"
#include "controls.h"
#include "debug.h"
#include "defs.h"
#include "events.h"
#include "icons.h"
@ -159,7 +158,7 @@ void Mouse_engine(void) {
case MOUSE_holding:
if (mousey < 400) {
mouse_mode = MOUSE_normal;
Zdebug(" releasing");
debug(5, " releasing");
}
break;
default:
@ -218,7 +217,7 @@ void System_menu(void) {
rv = g_sound->PauseFx();
if (rv != RD_OK)
Zdebug("ERROR: PauseFx() returned %.8x in SystemMenu()", rv);
debug(5, "ERROR: PauseFx() returned %.8x in SystemMenu()", rv);
// NB. Need to keep a safe copy of
// 'looping_music_id' for savegame & for
@ -296,7 +295,7 @@ void System_menu(void) {
rv = g_sound->UnpauseFx();
if (rv != RD_OK)
Zdebug("ERROR: UnpauseFx() returned %.8x in SystemMenu()", rv);
debug(5, "ERROR: UnpauseFx() returned %.8x in SystemMenu()", rv);
// If there was looping music before coming
// into the control panels then restart it!
@ -374,12 +373,9 @@ void Drag_mouse(void) {
CLICKED_ID = mouse_touching;
Set_player_action_event(CUR_PLAYER_ID, mouse_touching); // Tony4Dec96
Set_player_action_event(CUR_PLAYER_ID, mouse_touching);
#ifdef _SWORD2_DEBUG
// Write to walkthrough file (zebug0.txt)
Zdebug(0, "USED \"%s\" ICON ON %s", FetchObjectName(OBJECT_HELD), FetchObjectName(CLICKED_ID));
#endif
debug(5, "USED \"%s\" ICON ON %s", FetchObjectName(OBJECT_HELD), FetchObjectName(CLICKED_ID));
// Hide menu - back to normal menu mode
@ -409,13 +405,13 @@ void Drag_mouse(void) {
menu_selected_pos = 0;
} else {
// combine the 2 icons
// Zdebug("combine");
debug(5, "combine");
//what we clicked on, not what
// we're dragging
COMBINE_BASE = master_menu_list[pos].icon_resource;
Set_player_action_event(CUR_PLAYER_ID, MENU_MASTER_OBJECT); //Tony4Dec96
Set_player_action_event(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
// turn off mouse now, to
// prevent player trying to
@ -424,16 +420,12 @@ void Drag_mouse(void) {
No_human();
#ifdef _SWORD2_DEBUG
// Write to walkthrough file
// (zebug0.txt)
Zdebug(0, "USED \"%s\" ICON ON \"%s\" ICON", FetchObjectName(OBJECT_HELD), FetchObjectName(COMBINE_BASE));
#endif
debug(5, "USED \"%s\" ICON ON \"%s\" ICON", FetchObjectName(OBJECT_HELD), FetchObjectName(COMBINE_BASE));
}
// refresh the menu
Build_top_menu();
// Zdebug("switch to top mode");
debug(5, "switch to top mode");
}
}
}
@ -481,13 +473,9 @@ void Top_menu_mouse(void) {
EXIT_CLICK_ID = 0;
#ifdef _SWORD2_DEBUG
// Write to walkthrough file
// (zebug0.txt)
Zdebug(0, "RIGHT-CLICKED ON \"%s\" ICON", FetchObjectName(OBJECT_HELD));
#endif
debug(5, "RIGHT-CLICKED ON \"%s\" ICON", FetchObjectName(OBJECT_HELD));
Set_player_action_event(CUR_PLAYER_ID, MENU_MASTER_OBJECT); // Tony4Dec96
Set_player_action_event(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
// refresh the menu
Build_top_menu();
@ -509,14 +497,13 @@ void Top_menu_mouse(void) {
current_luggage_resource = master_menu_list[pos].luggage_resource;
mouse_mode = MOUSE_drag;
// Zdebug("setting OH in top menu");
debug(5, "setting OH in top menu");
// id the object via its graphic
OBJECT_HELD = master_menu_list[pos].icon_resource;
// (JEL09oct97) must clear this so
// next click on exit becomes 1st
// click again
// must clear this so next click on
// exit becomes 1st click again
EXIT_CLICK_ID = 0;
@ -524,7 +511,7 @@ void Top_menu_mouse(void) {
Build_top_menu();
Set_luggage(master_menu_list[pos].luggage_resource);
// Zdebug("switch to drag mode");
debug(5, "switch to drag mode");
}
}
}
@ -692,15 +679,12 @@ void Normal_mouse(void) {
Set_player_action_event(CUR_PLAYER_ID, mouse_touching); //Tony4Dec96
#ifdef _SWORD2_DEBUG
// Write to walkthrough file (zebug0.txt)
if (OBJECT_HELD)
Zdebug(0, "USED \"%s\" ICON ON %s", FetchObjectName(OBJECT_HELD), FetchObjectName(CLICKED_ID));
debug(5, "USED \"%s\" ICON ON %s", FetchObjectName(OBJECT_HELD), FetchObjectName(CLICKED_ID));
else if (LEFT_BUTTON)
Zdebug(0, "LEFT-CLICKED ON %s", FetchObjectName(CLICKED_ID));
debug(5, "LEFT-CLICKED ON %s", FetchObjectName(CLICKED_ID));
else // RIGHT BUTTON
Zdebug(0, "RIGHT-CLICKED ON %s", FetchObjectName(CLICKED_ID));
#endif
debug(5, "RIGHT-CLICKED ON %s", FetchObjectName(CLICKED_ID));
}
}
@ -1187,7 +1171,7 @@ int32 FN_register_mouse(int32 *params) {
// param 0 pointer to Object_mouse or 0 for no write to mouse
// list
// Zdebug(1, "cur_mouse = %d", cur_mouse);
debug(5, "cur_mouse = %d", cur_mouse);
Object_mouse *ob_mouse = (Object_mouse *) params[0];
@ -1195,7 +1179,7 @@ int32 FN_register_mouse(int32 *params) {
if (ob_mouse->pointer) {
#ifdef _SWORD2_DEBUG
if (cur_mouse == TOTAL_mouse_list)
Con_fatal_error("ERROR: mouse_list full [%s line %u]", __FILE__, __LINE__);
Con_fatal_error("ERROR: mouse_list full");
#endif
mouse_list[cur_mouse].x1 = ob_mouse->x1;
@ -1228,7 +1212,7 @@ int32 FN_register_mouse(int32 *params) {
mouse_list[cur_mouse].anim_resource = 0;
mouse_list[cur_mouse].anim_pc = 0;
// Zdebug("mouse id %d", mouse_list[cur_mouse].id);
debug(5, "mouse id %d", mouse_list[cur_mouse].id);
cur_mouse++;
}
@ -1244,7 +1228,7 @@ int32 FN_register_pointer_text(int32 *params) {
#ifdef _SWORD2_DEBUG
if (cur_mouse == TOTAL_mouse_list)
Con_fatal_error("ERROR: mouse_list full [%s line %u]", __FILE__, __LINE__);
Con_fatal_error("ERROR: mouse_list full");
#endif
// current object id - used for checking pointer_text when mouse area

View File

@ -77,7 +77,7 @@ _layerHeader *FetchLayerHeader(uint8 *screenFile, uint16 layerNo) { // Chris 04O
_screenHeader *screenHead = FetchScreenHeader(screenFile);
if (layerNo > screenHead->noLayers - 1)
Con_fatal_error("FetchLayerHeader(%d) invalid layer number! (%s line %u)", layerNo, __FILE__, __LINE__);
Con_fatal_error("FetchLayerHeader(%d) invalid layer number!", layerNo);
#endif
_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
@ -112,7 +112,7 @@ _cdtEntry *FetchCdtEntry(uint8 *animFile, uint16 frameNo) {
#ifdef _SWORD2_DEBUG
if (frameNo > animHead->noAnimFrames - 1)
Con_fatal_error("FetchCdtEntry(animFile,%d) - anim only %d frames (%s line %u)", frameNo, animHead->noAnimFrames, __FILE__, __LINE__);
Con_fatal_error("FetchCdtEntry(animFile,%d) - anim only %d frames", frameNo, animHead->noAnimFrames);
#endif
return (_cdtEntry *) ((uint8 *) animHead + sizeof(_animHeader) + frameNo * sizeof(_cdtEntry));
@ -134,7 +134,7 @@ _parallax *FetchBackgroundParallaxLayer(uint8 *screenFile, int layer) {
#ifdef _SWORD2_DEBUG
if (mscreenHeader->bg_parallax[layer] == 0)
Con_fatal_error("FetchBackgroundParallaxLayer(%d) - No parallax layer exists (%s line %u)", layer, __FILE__, __LINE__);
Con_fatal_error("FetchBackgroundParallaxLayer(%d) - No parallax layer exists", layer);
#endif
return (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[layer]);
@ -145,7 +145,7 @@ _parallax *FetchBackgroundLayer(uint8 *screenFile) {
#ifdef _SWORD2_DEBUG
if (mscreenHeader->screen == 0)
Con_fatal_error("FetchBackgroundLayer (%d) - No background layer exists (%s line %u)", __FILE__, __LINE__);
Con_fatal_error("FetchBackgroundLayer (%d) - No background layer exists");
#endif
return (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->screen + sizeof(_screenHeader));
@ -156,7 +156,7 @@ _parallax *FetchForegroundParallaxLayer(uint8 *screenFile, int layer) {
#ifdef _SWORD2_DEBUG
if (mscreenHeader->fg_parallax[layer] == 0)
Con_fatal_error("FetchForegroundParallaxLayer(%d) - No parallax layer exists (%s line %u)",layer, __FILE__, __LINE__);
Con_fatal_error("FetchForegroundParallaxLayer(%d) - No parallax layer exists", layer);
#endif
return (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[layer]);

View File

@ -105,21 +105,17 @@ void resMan::InitResMan(void) {
total_clusters = 0;
if (!file.open("resource.inf")) {
Zdebug("InitResMan cannot *OPEN* resource.inf");
ExitWithReport("InitResMan cannot *OPEN* resource.inf [file=%s line=%u]", __FILE__, __LINE__);
error("InitResMan cannot *OPEN* resource.inf");
}
end = file.size();
// Zdebug("seek end %d %d", fh, end);
//get some space for the incoming resource file - soon to be trashed
temp = Twalloc(end, MEM_locked, UID_temp);
if (file.read(temp->ad, end) != end) {
file.close();
Zdebug("InitResMan cannot *READ* resource.inf");
ExitWithReport("InitResMan cannot *READ* resource.inf [file=%s line=%u]", __FILE__, __LINE__);
error("InitResMan cannot *READ* resource.inf");
}
file.close();
@ -149,8 +145,7 @@ void resMan::InitResMan(void) {
// now load in the binary id to res conversion table
if (!file.open("resource.tab")) {
Zdebug("InitResMan cannot *OPEN* resource.tab");
ExitWithReport("InitResMan cannot *OPEN* resource.tab [file=%s line=%u]", __FILE__, __LINE__);
error("InitResMan cannot *OPEN* resource.tab");
}
// find how many resources
@ -166,15 +161,13 @@ void resMan::InitResMan(void) {
if (file.ioFailed()) {
file.close();
Zdebug("InitResMan cannot *READ* resource.tab");
ExitWithReport("InitResMan cannot *READ* resource.tab [file=%s line=%u]", __FILE__, __LINE__);
error("InitResMan cannot *READ* resource.tab");
}
file.close();
if (!file.open("cd.inf")) {
Zdebug("InitResMan cannot *OPEN* cd.inf");
ExitWithReport("InitResMan cannot *OPEN* cd.inf [file=%s line=%u]", __FILE__, __LINE__);
error("InitResMan cannot *OPEN* cd.inf");
}
_cd_inf *cdInf = new _cd_inf[total_clusters];
@ -184,8 +177,7 @@ void resMan::InitResMan(void) {
cdInf[j].cd = file.readByte();
if (file.ioFailed()) {
Zdebug("InitResMan failed to read cd.inf. Insufficient entries?");
ExitWithReport("InitResMan failed to read cd.inf. Insufficient entries? [file=%s line=%u]", __FILE__, __LINE__);
error("InitResMan failed to read cd.inf. Insufficient entries?");
}
}
@ -198,17 +190,15 @@ void resMan::InitResMan(void) {
i++;
if (i == total_clusters) {
Zdebug("InitResMan, %s is not in cd.inf", resource_files[j]);
ExitWithReport("InitResMan, %s is not in cd.inf [file=%s line=%u]",resource_files[j], __FILE__, __LINE__);
error("InitResMan, %s is not in cd.inf",resource_files[j]);
} else
cdTab[j] = cdInf[i].cd;
}
Zdebug("\n%d resources in %d cluster files", total_res_files, total_clusters);
debug(5, "%d resources in %d cluster files", total_res_files, total_clusters);
for (j = 0; j < total_clusters; j++)
Zdebug("filename of cluster %d: -%s", j, resource_files[j]);
Zdebug("");
debug(5, "filename of cluster %d: -%s", j, resource_files[j]);
// create space for a list of pointers to mem's
resList = (mem **) malloc(total_res_files * sizeof(mem *));
@ -241,8 +231,7 @@ void resMan::InitResMan(void) {
cdDrives[index++] = 'C';
if (index == 0) {
Zdebug("InitResMan, cannot find CD drive.");
ExitWithReport("InitResMan, cannot find CD drive. [file=%s line=%u]", __FILE__, __LINE__);
error("InitResMan, cannot find CD drive");
}
while (index < 24)
@ -487,7 +476,7 @@ uint8 *resMan::Res_open(uint32 res) {
// first we have to find the file via the res_conv_table
// Zdebug("resOpen %s res %d", resource_files[parent_res_file], res);
debug(5, "resOpen %s res %d", resource_files[parent_res_file], res);
// ** at this point here we start to think about where the
// ** file is and prompt the user for the right CD to be
@ -532,10 +521,10 @@ uint8 *resMan::Res_open(uint32 res) {
// 1st DWORD of a cluster is an offset to the look-up table
table_offset = file.readUint32LE();
// Zdebug("table offset = %d", table_offset);
debug(5, "table offset = %d", table_offset);
// 2 dwords per resource
file.seek(table_offset + actual_res *8, SEEK_SET);
file.seek(table_offset + actual_res * 8, SEEK_SET);
// get position of our resource within the cluster file
pos = file.readUint32LE();
// read the length
@ -544,7 +533,7 @@ uint8 *resMan::Res_open(uint32 res) {
// ** get to position in file of our particular resource
file.seek(pos, SEEK_SET);
// Zdebug("res len %d", len);
debug(5, "res len %d", len);
// ok, we know the length so try and allocate the memory
// if it can't then old files will be ditched until it works
@ -566,7 +555,7 @@ uint8 *resMan::Res_open(uint32 res) {
convertEndian((uint8 *)resList[res]->ad, len);
#endif
} else {
// Zdebug("RO %d, already open count=%d", res, count[res]);
debug(5, "RO %d, already open count=%d", res, count[res]);
}
// number of times opened - the file won't move in memory while count
@ -743,7 +732,7 @@ uint32 resMan::Help_the_aged_out(void) {
if (!oldest_res)
return 0;
// Zdebug(42,"removing %d, age %d, size %d", oldest_res, age[oldest_res], resList[oldest_res]->size);
debug(5, "removing %d, age %d, size %d", oldest_res, age[oldest_res], resList[oldest_res]->size);
// trash this old resource
@ -921,9 +910,9 @@ void resMan::Remove_res(uint32 res) {
if (age[res]) {
age[res] = 0; //effectively gone from resList
Free_mem(resList[res]); //release the memory too
// Zdebug(" - Trashing %d", res);
debug(5, " - Trashing %d", res);
} else
Zdebug("Remove_res(%d) not even in memory!",res);
debug(5, "Remove_res(%d) not even in memory!", res);
}
void resMan::Remove_all_res(void) {
@ -978,7 +967,7 @@ void resMan::Kill_all_res(uint8 wantInfo) {
// want info
if (wantInfo && console_status) {
Print_to_console(" nuked %5d: %s", res, header->name);
Zdebug(" nuked %d: %s", res, header->name);
debug(5, " nuked %d: %s", res, header->name);
Build_display();
scrolls++;
@ -1050,7 +1039,7 @@ void resMan::Kill_all_objects(uint8 wantInfo) {
// if this was called from the console + we want info
if (wantInfo && console_status) {
Print_to_console(" nuked %5d: %s", res, header->name);
Zdebug(" nuked %d: %s", res, header->name);
debug(5, " nuked %d: %s", res, header->name);
Build_display();
scrolls++;
@ -1111,8 +1100,7 @@ void resMan::CacheNewCluster(uint32 newCluster) {
file = fopen("cd.inf", "r+b");
if (file == NULL) {
Zdebug("CacheNewCluster cannot *OPEN* cd.inf");
Con_fatal_error("InitResMan cannot *OPEN* cd.inf [file=%s line=%u]", __FILE__, __LINE__);
Con_fatal_error("InitResMan cannot *OPEN* cd.inf");
}
_cd_inf cdInf;
@ -1122,7 +1110,6 @@ void resMan::CacheNewCluster(uint32 newCluster) {
} while ((scumm_stricmp((char *) cdInf.clusterName, resource_files[i]) != 0) && !feof(file));
if (feof(file)) {
Zdebug("CacheNewCluster cannot find %s in cd.inf", resource_files[i]);
Con_fatal_error("CacheNewCluster cannot find %s in cd.inf", resource_files[i]);
}
@ -1167,8 +1154,7 @@ void resMan::CacheNewCluster(uint32 newCluster) {
outFile.open(resource_files[newCluster], NULL, File::kFileWriteMode);
if (!inFile.isOpen() || !outFile.isOpen()) {
Zdebug("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
Con_fatal_error("Cache new cluster could not copy %s to %s [file=%s line=%u]", buf, resource_files[newCluster], __FILE__, __LINE__);
Con_fatal_error("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
}
_spriteInfo textSprite;
@ -1250,8 +1236,7 @@ void resMan::CacheNewCluster(uint32 newCluster) {
realRead = inFile.read(buffer, BUFFERSIZE);
read += realRead;
if (outFile.write(buffer, realRead) != realRead) {
Zdebug("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
Con_fatal_error("Cache new cluster could not copy %s to %s [file=%s line=%u]", buf, resource_files[newCluster], __FILE__, __LINE__);
Con_fatal_error("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
}
if (step == stepSize) {
@ -1283,8 +1268,7 @@ void resMan::CacheNewCluster(uint32 newCluster) {
} while ((read % BUFFERSIZE) == 0);
if (read != size) {
Zdebug("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
Con_fatal_error("Cache new cluster could not copy %s to %s [file=%s line=%u]", buf, resource_files[newCluster], __FILE__, __LINE__);
Con_fatal_error("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
}
inFile.close();
@ -1308,8 +1292,7 @@ void resMan::CacheNewCluster(uint32 newCluster) {
file = fopen("cd.inf", "r+b");
if (file == NULL) {
Zdebug("CacheNewCluster cannot *OPEN* cd.inf");
Con_fatal_error("InitResMan cannot *OPEN* cd.inf [file=%s line=%u]", __FILE__, __LINE__);
Con_fatal_error("InitResMan cannot *OPEN* cd.inf");
}
_cd_inf cdInf;
@ -1319,7 +1302,6 @@ void resMan::CacheNewCluster(uint32 newCluster) {
} while (scumm_stricmp((char *) cdInf.clusterName, resource_files[newCluster]) != 0 && !feof(file));
if (feof(file)) {
Zdebug("CacheNewCluster cannot find %s in cd.inf", resource_files[newCluster]);
Con_fatal_error("CacheNewCluster cannot find %s in cd.inf", resource_files[newCluster]);
}
@ -1386,7 +1368,7 @@ void resMan::GetCd(int cd) {
// must be running off the network, but still want to see
// CD-requests to show where they would occur when playing
// from CD
Zdebug("RUNNING OFF NETWORK");
debug(5, "RUNNING OFF NETWORK");
fscanf(file, "%s", cdPath);
fclose(file);

View File

@ -652,9 +652,9 @@ int32 SmoothestPath() {
#ifdef _SWORD2_DEBUG
if (options == 0) {
Zdebug("BestTurns fail %d %d %d %d", route[p].x, route[p].y, route[p + 1].x, route[p + 1].y);
Zdebug("BestTurns fail %d %d %d %d", turns[0], turns[1], turns[2], options);
Con_fatal_error("BestTurns failed (%s line %u)", __FILE__, __LINE__);
debug(5, "BestTurns fail %d %d %d %d", route[p].x, route[p].y, route[p + 1].x, route[p + 1].y);
debug(5, "BestTurns fail %d %d %d %d", turns[0], turns[1], turns[2], options);
Con_fatal_error("BestTurns failed");
}
#endif
@ -670,9 +670,9 @@ int32 SmoothestPath() {
#ifdef _SWORD2_DEBUG
if (steps == 0) {
Zdebug("BestTurns failed %d %d %d %d", route[p].x, route[p].y, route[p + 1].x, route[p + 1].y);
Zdebug("BestTurns failed %d %d %d %d", turns[0], turns[1], turns[2], options);
Con_fatal_error("BestTurns failed (%s line %u)", __FILE__, __LINE__);
debug(5, "BestTurns failed %d %d %d %d", route[p].x, route[p].y, route[p + 1].x, route[p + 1].y);
debug(5, "BestTurns failed %d %d %d %d", turns[0], turns[1], turns[2], options);
Con_fatal_error("BestTurns failed");
}
#endif
@ -935,17 +935,17 @@ void EarlySlowOut(Object_mega *ob_mega, Object_walkdata *ob_walkdata) {
int32 walk_pc;
_walkData *walkAnim;
// Zdebug("\nEARLY SLOW-OUT");
debug(5, "EARLY SLOW-OUT");
LoadWalkData(ob_walkdata);
// Zdebug("********************************");
// Zdebug("framesPerStep =%d", framesPerStep);
// Zdebug("numberOfSlowOutFrames =%d", numberOfSlowOutFrames);
// Zdebug("firstWalkingTurnLeftFrame =%d", firstWalkingTurnLeftFrame);
// Zdebug("firstWalkingTurnRightFrame =%d", firstWalkingTurnRightFrame);
// Zdebug("firstSlowOutFrame =%d", firstSlowOutFrame);
// Zdebug("********************************");
debug(5, "********************************");
debug(5, "framesPerStep = %d", framesPerStep);
debug(5, "numberOfSlowOutFrames = %d", numberOfSlowOutFrames);
debug(5, "firstWalkingTurnLeftFrame = %d", firstWalkingTurnLeftFrame);
debug(5, "firstWalkingTurnRightFrame = %d", firstWalkingTurnRightFrame);
debug(5, "firstSlowOutFrame = %d", firstSlowOutFrame);
debug(5, "********************************");
walk_pc = ob_mega->walk_pc;
@ -958,8 +958,8 @@ void EarlySlowOut(Object_mega *ob_mega, Object_walkdata *ob_walkdata) {
// (ie .step - 0..5)
do {
// Zdebug("\nSTEP NUMBER: walkAnim[%d].step = %d", walk_pc, walkAnim[walk_pc].step);
// Zdebug("ORIGINAL FRAME: walkAnim[%d].frame = %d", walk_pc, walkAnim[walk_pc].frame);
debug(5, "STEP NUMBER: walkAnim[%d].step = %d", walk_pc, walkAnim[walk_pc].step);
debug(5, "ORIGINAL FRAME: walkAnim[%d].frame = %d", walk_pc, walkAnim[walk_pc].frame);
// map from existing walk frame across to correct
// frame number of slow-out - remember, there may be
@ -971,29 +971,27 @@ void EarlySlowOut(Object_mega *ob_mega, Object_walkdata *ob_walkdata) {
// frame first
walkAnim[walk_pc].frame -= firstWalkingTurnRightFrame;
// Zdebug("MAPPED TO WALK: walkAnim[%d].frame = %d (walking turn-right frame --> walk frame)", walk_pc, walkAnim[walk_pc].frame);
debug(5, "MAPPED TO WALK: walkAnim[%d].frame = %d (walking turn-right frame --> walk frame)", walk_pc, walkAnim[walk_pc].frame);
} else if (walkAnim[walk_pc].frame >= firstWalkingTurnLeftFrame) {
// if it's a walking turn-left, rather than a
// normal step, then map it to a normal step
// frame first
walkAnim[walk_pc].frame -= firstWalkingTurnLeftFrame;
// Zdebug("MAPPED TO WALK: walkAnim[%d].frame = %d (walking turn-left frame --> walk frame)", walk_pc, walkAnim[walk_pc].frame);
debug(5, "MAPPED TO WALK: walkAnim[%d].frame = %d (walking turn-left frame --> walk frame)", walk_pc, walkAnim[walk_pc].frame);
}
walkAnim[walk_pc].frame += firstSlowOutFrame + ((walkAnim[walk_pc].frame / framesPerStep) * (numberOfSlowOutFrames - framesPerStep));
walkAnim[walk_pc].step = 0;
// Zdebug("SLOW-OUT FRAME: walkAnim[%d].frame = %d",walk_pc, walkAnim[walk_pc].frame);
debug(5, "SLOW-OUT FRAME: walkAnim[%d].frame = %d",walk_pc, walkAnim[walk_pc].frame);
walk_pc++;
} while(walkAnim[walk_pc].step > 0);
// Zdebug("\n");
// add stationary frame(s) (OPTIONAL)
for (slowOutFrameNo = framesPerStep; slowOutFrameNo < numberOfSlowOutFrames; slowOutFrameNo++) {
walkAnim[walk_pc].frame = walkAnim[walk_pc - 1].frame + 1;
// Zdebug("EXTRA FRAME: walkAnim[%d].frame = %d", walk_pc, walkAnim[walk_pc].frame);
debug(5, "EXTRA FRAME: walkAnim[%d].frame = %d", walk_pc, walkAnim[walk_pc].frame);
walkAnim[walk_pc].step = 0;
walkAnim[walk_pc].dir = walkAnim[walk_pc - 1].dir;
walkAnim[walk_pc].x = walkAnim[walk_pc - 1].x;
@ -1034,7 +1032,7 @@ void AddSlowOutFrames(_walkData *walkAnim) {
slowOutFrameNo = lastCount - framesPerStep;
// Zdebug("SLOW OUT: slowOutFrameNo(%d) = lastCount(%d) - framesPerStep(%d)", slowOutFrameNo, lastCount, framesPerStep);
debug(5, "SLOW OUT: slowOutFrameNo(%d) = lastCount(%d) - framesPerStep(%d)", slowOutFrameNo, lastCount, framesPerStep);
// overwrite the last step (half a cycle) of the walk
@ -1048,7 +1046,7 @@ void AddSlowOutFrames(_walkData *walkAnim) {
// because no longer a normal walk-step
walkAnim[slowOutFrameNo].step = 0;
//Zdebug("walkAnim[%d].frame = %d",slowOutFrameNo,walkAnim[slowOutFrameNo].frame);
debug(5, "walkAnim[%d].frame = %d",slowOutFrameNo,walkAnim[slowOutFrameNo].frame);
slowOutFrameNo++;
} while(slowOutFrameNo < lastCount);
@ -1057,7 +1055,7 @@ void AddSlowOutFrames(_walkData *walkAnim) {
for (slowOutFrameNo = framesPerStep; slowOutFrameNo < numberOfSlowOutFrames; slowOutFrameNo++) {
walkAnim[stepCount].frame = walkAnim[stepCount - 1].frame + 1;
// Zdebug("EXTRA FRAMES: walkAnim[%d].frame = %d", stepCount, walkAnim[stepCount].frame);
debug(5, "EXTRA FRAMES: walkAnim[%d].frame = %d", stepCount, walkAnim[stepCount].frame);
walkAnim[stepCount].step = 0;
walkAnim[stepCount].dir = walkAnim[stepCount - 1].dir;
@ -1117,7 +1115,7 @@ void SlidyWalkAnimator(_walkData *walkAnim) {
// START THE WALK WITH THE FIRST STANDFRAME THIS MAY CAUSE A DELAY
// BUT IT STOPS THE PLAYER MOVING FOR COLLISIONS ARE DETECTED
// Zdebug("\nSLIDY: STARTING THE WALK");
debug(5, "SLIDY: STARTING THE WALK");
module = framesPerChar + lastDir;
walkAnim[stepCount].frame = module;
@ -1129,7 +1127,7 @@ void SlidyWalkAnimator(_walkData *walkAnim) {
// TURN TO START THE WALK
// Zdebug("\nSLIDY: TURNING TO START THE WALK");
debug(5, "SLIDY: TURNING TO START THE WALK");
// rotate if we need to
if (lastDir != currentDir) {
@ -1199,7 +1197,7 @@ void SlidyWalkAnimator(_walkData *walkAnim) {
// THE WALK
// Zdebug("\nSLIDY: THE WALK");
debug(5, "SLIDY: THE WALK");
// start the walk on the left or right leg, depending on how the
// slow-in frames were drawn
@ -1393,7 +1391,7 @@ void SlidyWalkAnimator(_walkData *walkAnim) {
#ifdef _SWORD2_DEBUG
if (lastRealDir == 99)
Con_fatal_error("SlidyWalkAnimatorlast direction error (%s line %u)", __FILE__, __LINE__);
Con_fatal_error("SlidyWalkAnimatorlast direction error");
#endif
// THE SLOW OUT
@ -1504,15 +1502,13 @@ void SlidyWalkAnimator(_walkData *walkAnim) {
walkAnim[stepCount].frame = 512;
walkAnim[stepCount].step = 99;
#ifdef _SWORD2_DEBUG
// write all the frames to "debug.txt"
// Zdebug("\nTHE WALKDATA:");
debug(5, "THE WALKDATA:");
for (frame = 0; frame <= stepCount; frame++)
Zdebug("walkAnim[%d].frame=%d", frame, walkAnim[frame].frame);
#endif
debug(5, "walkAnim[%d].frame=%d", frame, walkAnim[frame].frame);
// Zdebug("RouteFinder RouteSize is %d", stepCount);
debug(5, "RouteFinder RouteSize is %d", stepCount);
return;
}
@ -1632,7 +1628,7 @@ int32 SolidWalkAnimator(_walkData *walkAnim) {
// START THE WALK WITH THE FIRST STANDFRAME THIS MAY CAUSE A DELAY
// BUT IT STOPS THE PLAYER MOVING FOR COLLISIONS ARE DETECTED
//Zdebug("\nSOLID: STARTING THE WALK");
debug(5, "SOLID: STARTING THE WALK");
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
walkAnim[stepCount].dir = lastDir;
@ -1642,7 +1638,7 @@ int32 SolidWalkAnimator(_walkData *walkAnim) {
// TURN TO START THE WALK
// Zdebug("\nSOLID: TURNING TO START THE WALK");
debug(5, "SOLID: TURNING TO START THE WALK");
// rotate if we need to
@ -1712,7 +1708,7 @@ int32 SolidWalkAnimator(_walkData *walkAnim) {
// THE WALK
// Zdebug("\nSOLID: THE WALK");
debug(5, "SOLID: THE WALK");
// start the walk on the left or right leg, depending on how the
// slow-in frames were drawn
@ -1879,17 +1875,14 @@ int32 SolidWalkAnimator(_walkData *walkAnim) {
walkAnim[stepCount].frame = 512;
walkAnim[stepCount].step = 99;
#ifdef _SWORD2_DEBUG
// write all the frames to "debug.txt"
//Zdebug("\nTHE WALKDATA:");
debug(5, "THE WALKDATA:");
for (frame = 0; frame <= stepCount; frame++)
Zdebug("walkAnim[%d].frame=%d", frame, walkAnim[frame].frame);
#endif
debug(5, "walkAnim[%d].frame=%d", frame, walkAnim[frame].frame);
// NO END TURNS
// Zdebug("RouteFinder RouteSize is %d", stepCount);
debug(5, "RouteFinder RouteSize is %d", stepCount);
// now check the route
i = 0;
@ -1905,7 +1898,7 @@ int32 SolidWalkAnimator(_walkData *walkAnim) {
if (CheckTarget(moduleX, moduleY) == 3) {
// new target on a line
p = 0;
// Zdebug("Solid walk target was on a line %d %d", moduleX, moduleY);
debug(5, "Solid walk target was on a line %d %d", moduleX, moduleY);
}
}
@ -2403,7 +2396,7 @@ int32 CheckTarget(int32 x, int32 y) {
if (yc >= ymin && yc <= ymax) {
// target on a line so drop out
onLine = 3;
// Zdebug("RouteFail due to target on a line %d %d", x, y);
debug(5, "RouteFail due to target on a line %d %d", x, y);
} else {
// vertical line so we know it overlaps y
if (bars[i].dy == 0)
@ -2417,7 +2410,7 @@ int32 CheckTarget(int32 x, int32 y) {
if (xc >= xmin && xc <= xmax) {
// target on a line so drop out
onLine = 3;
// Zdebug("RouteFail due to target on a line %d %d", x, y);
debug(5, "RouteFail due to target on a line %d %d", x, y);
}
}
}
@ -2755,14 +2748,14 @@ void LoadWalkGrid(void) {
// allowed in the complete walkgrid arrays
if (nbars + theseBars >= O_GRID_SIZE)
Con_fatal_error("Adding walkgrid(%d): %d+%d bars exceeds max %d (%s line %u)",
Con_fatal_error("Adding walkgrid(%d): %d+%d bars exceeds max %d",
walkGridList[entry], nbars, theseBars,
O_GRID_SIZE, __FILE__, __LINE__);
O_GRID_SIZE);
if (nnodes + theseNodes >= O_GRID_SIZE)
Con_fatal_error("Adding walkgrid(%d): %d+%d nodes exceeds max %d (%s line %u)",
Con_fatal_error("Adding walkgrid(%d): %d+%d nodes exceeds max %d",
walkGridList[entry], nnodes, theseBars,
O_GRID_SIZE, __FILE__, __LINE__);
O_GRID_SIZE);
#endif
// lines
@ -2836,7 +2829,7 @@ void AddWalkGrid(int32 gridResource) {
if (entry < MAX_WALKGRIDS)
walkGridList[entry] = gridResource;
else
Con_fatal_error("ERROR: walkGridList[] full in %s line %d", __FILE__, __LINE__);
Con_fatal_error("ERROR: walkGridList[] full");
}
}

View File

@ -455,16 +455,7 @@ uint32 RestoreFromBuffer(mem *buffer, uint32 size) {
// Write to walkthrough file (zebug0.txt)
#ifdef _SWORD2_DEBUG
Zdebug(0, "*************************************");
Zdebug(0, "RESTORED GAME \"%s\"", g_header.description);
Zdebug(0, "*************************************");
// Also write this to system debug file
Zdebug("*************************************");
Zdebug("RESTORED GAME \"%s\"", g_header.description);
Zdebug("*************************************");
#endif
debug(5, "RESTORED GAME \"%s\"", g_header.description);
// game restored ok
return SR_OK;
@ -528,7 +519,7 @@ void GetPlayerStructures(void) {
head = (_standardHeader*) res_man.Res_open(CUR_PLAYER_ID);
if (head->fileType != GAME_OBJECT)
Con_fatal_error("incorrect CUR_PLAYER_ID=%d (%s line %u)", CUR_PLAYER_ID, __FILE__, __LINE__);
Con_fatal_error("incorrect CUR_PLAYER_ID=%d", CUR_PLAYER_ID);
raw_script_ad = (char *) head;
RunScript(raw_script_ad, raw_script_ad, &null_pc);
@ -547,7 +538,7 @@ void PutPlayerStructures(void) {
head = (_standardHeader*) res_man.Res_open(CUR_PLAYER_ID);
if (head->fileType != GAME_OBJECT)
Con_fatal_error("incorrect CUR_PLAYER_ID=%d (%s line %u)", CUR_PLAYER_ID, __FILE__, __LINE__);
Con_fatal_error("incorrect CUR_PLAYER_ID=%d", CUR_PLAYER_ID);
raw_script_ad = (char *) head;

View File

@ -18,6 +18,7 @@
*/
#include "stdafx.h"
#include "driver/driver96.h"
#include "debug.h"
#include "defs.h"
#include "header.h"
@ -81,7 +82,7 @@ void Set_scrolling(void) {
// immediately!
if (this_screen.scroll_flag == 2) {
// Zdebug(42,"init scroll");
debug(5, "init scroll");
this_screen.scroll_offset_x = offset_x;
this_screen.scroll_offset_y = offset_y;
this_screen.scroll_flag = 1;

View File

@ -129,10 +129,8 @@ void Trigger_fx(uint8 j) {
}
}
#ifdef _SWORD2_DEBUG
if (rv)
Zdebug("SFX ERROR: PlayFx() returned %.8x (%s line %u)", rv, __FILE__, __LINE__);
#endif
debug(5, "SFX ERROR: PlayFx() returned %.8x", rv);
}
// called from script only
@ -177,7 +175,7 @@ int32 FN_play_fx(int32 *params) {
strcpy(type, "INVALID");
}
Zdebug("SFX (sample=\"%s\", vol=%d, pan=%d, delay=%d, type=%s)", FetchObjectName(params[0]), params[3], params[4], params[2], type);
debug(5, "SFX (sample=\"%s\", vol=%d, pan=%d, delay=%d, type=%s)", FetchObjectName(params[0]), params[3], params[4], params[2], type);
}
#endif
@ -211,7 +209,7 @@ int32 FN_play_fx(int32 *params) {
#ifdef _SWORD2_DEBUG
header = (_standardHeader*) data;
if (header->fileType != WAV_FILE)
Con_fatal_error("FN_play_fx given invalid resource (%s line %u)", __FILE__, __LINE__);
Con_fatal_error("FN_play_fx given invalid resource");
#endif
// but then releases it to "age" out if the space is needed
@ -227,7 +225,7 @@ int32 FN_play_fx(int32 *params) {
#ifdef _SWORD2_DEBUG
header = (_standardHeader*)data;
if (header->fileType != WAV_FILE)
Con_fatal_error("FN_play_fx given invalid resource (%s line %u)", __FILE__, __LINE__);
Con_fatal_error("FN_play_fx given invalid resource");
#endif
data += sizeof(_standardHeader);
@ -235,10 +233,8 @@ int32 FN_play_fx(int32 *params) {
// copy it to sound memory, using position in queue as 'id'
rv = g_sound->OpenFx(id, data);
#ifdef _SWORD2_DEBUG
if (rv)
Zdebug("SFX ERROR: OpenFx() returned %.8x (%s line %u)", rv, __FILE__, __LINE__);
#endif
debug(5, "SFX ERROR: OpenFx() returned %.8x", rv);
// release the sample
res_man.Res_close(fxq[j].resource);
@ -271,7 +267,7 @@ int32 FN_set_fx_vol_and_pan(int32 *params) {
// 1 new volume (0..16)
// 2 new pan (-16..16)
// Zdebug("%d", params[2]);
debug(5, "FN_set_fx_vol_and_pan(%d, %d, %d)", params[0], params[1], params[2]);
// SetFxVolumePan(int32 id, uint8 vol, uint8 pan);
// driver fx_id is 1 + <pos in queue>
@ -310,10 +306,8 @@ int32 FN_stop_fx(int32 *params) {
// stop fx & remove sample from sound memory
rv = g_sound->CloseFx(id);
#ifdef _SWORD2_DEBUG
if (rv)
Zdebug("SFX ERROR: CloseFx() returned %.8x (%s line %u)", rv, __FILE__, __LINE__);
#endif
debug(5, "SFX ERROR: CloseFx() returned %.8x", rv);
}
// remove from queue
@ -379,7 +373,7 @@ int32 FN_play_music(int32 *params) {
bool loopFlag;
uint32 rv;
// Zdebug("FN_play_music(%d)", params[0]);
debug(5, "FN_play_music(%d, %d)", params[0], params[1]);
if (params[1] == FX_LOOP) {
loopFlag = true;
@ -414,12 +408,8 @@ int32 FN_play_music(int32 *params) {
rv = g_sound->StreamCompMusic(filename, params[0], loopFlag);
#ifdef _SWORD2_DEBUG
if (rv)
Zdebug("ERROR: StreamCompMusic(%s, %d, %d) returned error 0x%.8x", filename, params[0], loopFlag, rv);
#endif
// Zdebug("FN_play_music(%d) returning", params[0]);
if (rv)
debug(5, "ERROR: StreamCompMusic(%s, %d, %d) returned error 0x%.8x", filename, params[0], loopFlag, rv);
return IR_CONT;
}
@ -454,15 +444,15 @@ void PauseAllSound(void) {
rv = g_sound->PauseMusic();
if (rv != RD_OK)
Zdebug("ERROR: PauseMusic() returned %.8x in PauseAllSound()", rv);
debug(5, "ERROR: PauseMusic() returned %.8x in PauseAllSound()", rv);
rv = g_sound->PauseSpeech();
if (rv != RD_OK)
Zdebug("ERROR: PauseSpeech() returned %.8x in PauseAllSound()", rv);
debug(5, "ERROR: PauseSpeech() returned %.8x in PauseAllSound()", rv);
rv = g_sound->PauseFx();
if (rv != RD_OK)
Zdebug("ERROR: PauseFx() returned %.8x in PauseAllSound()", rv);
debug(5, "ERROR: PauseFx() returned %.8x in PauseAllSound()", rv);
}
void UnpauseAllSound(void) {
@ -470,13 +460,13 @@ void UnpauseAllSound(void) {
rv = g_sound->UnpauseMusic();
if (rv != RD_OK)
Zdebug("ERROR: UnpauseMusic() returned %.8x in UnpauseAllSound()", rv);
debug(5, "ERROR: UnpauseMusic() returned %.8x in UnpauseAllSound()", rv);
rv = g_sound->UnpauseSpeech();
if (rv != RD_OK)
Zdebug("ERROR: UnpauseSpeech() returned %.8x in UnpauseAllSound()", rv);
debug(5, "ERROR: UnpauseSpeech() returned %.8x in UnpauseAllSound()", rv);
rv = g_sound->UnpauseFx();
if (rv != RD_OK)
Zdebug("ERROR: UnpauseFx() returned %.8x in UnpauseAllSound()", rv);
debug(5, "ERROR: UnpauseFx() returned %.8x in UnpauseAllSound()", rv);
}

View File

@ -128,7 +128,7 @@ int32 FN_add_subject(int32 *params) {
subject_list[IN_SUBJECT].res = params[0];
subject_list[IN_SUBJECT].ref = params[1];
// Zdebug("FN_add_subject res %d, uid %d", params[0], params[1]);
debug(5, "FN_add_subject res %d, uid %d", params[0], params[1]);
IN_SUBJECT++;
}
@ -149,12 +149,11 @@ int32 FN_choose(int32 *params) {
uint8 *icon;
uint32 pos = 0;
// Zdebug("into choose");
debug(5, "FN_choose");
AUTO_SELECTED = 0; // see below
// new thing to intercept objects held at time of clicking on a person
// (James 06may97)
if (OBJECT_HELD) {
// If we are using a luggage icon on the person, scan the
@ -194,7 +193,6 @@ int32 FN_choose(int32 *params) {
}
// new thing for skipping chooser with "nothing else to say" text
// (James 23may97)
// If this is the 1st time the chooser is coming up in this
// conversation, AND there's only 1 subject, AND it's the EXIT icon
@ -220,13 +218,13 @@ int32 FN_choose(int32 *params) {
for (j = 0; j < 15; j++) {
if (j < IN_SUBJECT) {
// Zdebug(" ICON res %d for %d", subject_list[j].res, j);
debug(5, " ICON res %d for %d", subject_list[j].res, j);
icon = res_man.Res_open(subject_list[j].res) + sizeof(_standardHeader) + RDMENU_ICONWIDE * RDMENU_ICONDEEP;
SetMenuIcon(RDMENU_BOTTOM, (uint8) j, icon);
res_man.Res_close(subject_list[j].res);
} else {
//no icon here
//Zdebug(" NULL for %d", j);
debug(5, " NULL for %d", j);
SetMenuIcon(RDMENU_BOTTOM, (uint8) j, NULL);
}
}
@ -243,7 +241,7 @@ int32 FN_choose(int32 *params) {
return IR_REPEAT;
} else {
// menu is there - we're just waiting for a click
// Zdebug("choosing");
debug(5, "choosing");
me = MouseEvent();
@ -261,20 +259,11 @@ int32 FN_choose(int32 *params) {
//clicked on something - what button?
if (hit < IN_SUBJECT) {
#ifdef _SWORD2_DEBUG
// Write to walkthrough file
// (zebug0.txt)
Zdebug(0, "----------------------");
Zdebug(0, "Icons available:");
#endif
debug(5, "Icons available:");
// change icons
for (j = 0; j < IN_SUBJECT; j++) {
#ifdef _SWORD2_DEBUG
// Write to walkthrough file
// (zebug0.txt)
Zdebug(0, "%s", FetchObjectName(subject_list[j].res));
#endif
debug(5, "%s", FetchObjectName(subject_list[j].res));
// change all others to grey
if (j != hit) {
@ -285,12 +274,7 @@ int32 FN_choose(int32 *params) {
}
#ifdef _SWORD2_DEBUG
// Write to walkthrough file
// (zebug0.txt)
Zdebug(0, "Selected: %s", FetchObjectName(subject_list[hit].res));
Zdebug(0, "----------------------");
#endif
debug(5, "Selected: %s", FetchObjectName(subject_list[hit].res));
// this is our looping flag
choosing = 0;
@ -300,7 +284,7 @@ int32 FN_choose(int32 *params) {
// blank mouse again
Set_mouse(0);
// Zdebug("hit %d - ref %d ref*8 %d", hit, subject_list[hit].ref, subject_list[hit].ref * 8);
debug(5, "hit %d - ref %d ref*8 %d", hit, subject_list[hit].ref, subject_list[hit].ref * 8);
// for non-speech scripts that manually
// call the chooser
@ -311,7 +295,9 @@ int32 FN_choose(int32 *params) {
}
}
}
// Zdebug("end choose");
debug(5, "end choose");
// again next cycle
return IR_REPEAT;
}
@ -325,7 +311,7 @@ int32 FN_start_conversation(int32 *params) {
// params: none
// Zdebug("FN_start_conversation %d", ID);
debug(5, "FN_start_conversation %d", ID);
// reset 'chooser_count_flag' at the start of each conversation:
@ -350,14 +336,14 @@ int32 FN_end_conversation(int32 *params) {
// FN_idle();
// params: none
// Zdebug("FN_end_conversation");
debug(5, "FN_end_conversation");
HideMenu(RDMENU_BOTTOM);
if (mousey > 399) {
// will wait for cursor to move off the bottom menu
mouse_mode = MOUSE_holding;
Zdebug(" holding");
debug(5, " holding");
}
TALK_FLAG = 0; //in-case DC forgets
@ -446,7 +432,7 @@ int32 FN_they_do_we_wait(int32 *params) {
_standardHeader *head;
int32 target = params[1];
// Zdebug("FN_they_do_we_wait id %d, command %d", params[1], params[2]);
debug(5, "FN_they_do_we_wait id %d, command %d", params[1], params[2]);
// ok, see if the target is busy - we must request this info from the
// target object
@ -467,7 +453,7 @@ int32 FN_they_do_we_wait(int32 *params) {
if (!INS_COMMAND && RESULT == 1 && ob_logic->looping == 0) {
// first time so set up targets command if target is waiting
// Zdebug("FNtdww sending command to %d", target);
debug(5, "FNtdww sending command to %d", target);
SPEECH_ID = params[1];
INS_COMMAND = params[2];
@ -500,7 +486,8 @@ int32 FN_they_do_we_wait(int32 *params) {
if (RESULT == 1) {
// its waiting now so we can be finished with all this
// Zdebug("FNtdww finished");
debug(5, "FNtdww finished");
// not looping anymore
ob_logic->looping = 0;
@ -510,7 +497,7 @@ int32 FN_they_do_we_wait(int32 *params) {
return IR_CONT;
}
// Zdebug("FNtdww just waiting");
debug(5, "FNtdww just waiting");
// debug flag to indicate who we're waiting for - see debug.cpp
speechScriptWaiting = target;
@ -614,7 +601,7 @@ int32 FN_timed_wait(int32 *params) {
// none of this should ever happen
Kill_all_ids_events(target);
Zdebug("EVENT timed out");
debug(5, "EVENT timed out");
// reset debug flag now that we're no longer waiting - see
// debug.cpp
@ -655,7 +642,7 @@ int32 FN_speech_process(int32 *params) {
ob_speech = (Object_speech *) params[1];
// Zdebug(" SP");
debug(5, " SP");
while(1) {
//we are currently running a command
@ -674,13 +661,14 @@ int32 FN_speech_process(int32 *params) {
pars[7] = ob_speech->ins4; // anim table res id
pars[8] = ob_speech->ins5; // animation mode - 0 lip synced, 1 just straight animation
// Zdebug("speech-process talk");
debug(5, "speech-process talk");
// run the function - (it thinks it's been called from
// script - bloody fool)
if (FN_i_speak(pars) != IR_REPEAT) {
// Zdebug("speech-process talk finished");
debug(5, "speech-process talk finished");
// command finished
ob_speech->command = 0;
@ -816,7 +804,8 @@ int32 FN_speech_process(int32 *params) {
pars[6] = ob_speech->ins3; // target direction
if (FN_walk(pars) != IR_REPEAT) {
// Zdebug("speech-process walk finished");
debug(5, "speech-process walk finished");
// command finished
ob_speech->command = 0;
@ -834,7 +823,8 @@ int32 FN_speech_process(int32 *params) {
pars[4] = ob_speech->ins1; // anim resource
if (FN_walk_to_anim(pars) != IR_REPEAT) {
// Zdebug("speech-process walk finished");
debug(5, "speech-process walk finished");
// command finished
ob_speech->command = 0;
@ -861,7 +851,8 @@ int32 FN_speech_process(int32 *params) {
ob_speech->wait_state = 1; // waiting for command
return IR_REPEAT; // come back again next cycle
case INS_quit:
// Zdebug("speech-process - quit");
debug(5, "speech-process - quit");
ob_speech->command = 0; // finish with all this
// ob_speech->wait_state = 0; // start with waiting for command next conversation
return IR_CONT; // thats it, we're finished with this
@ -894,7 +885,7 @@ int32 FN_speech_process(int32 *params) {
// now busy
ob_speech->wait_state = 0;
// Zdebug("received new command %d", INS_COMMAND);
debug(5, "received new command %d", INS_COMMAND);
// we'll drop off and be caught by the while(1), so
// kicking in the new command straight away
@ -1088,17 +1079,13 @@ int32 FN_i_speak(int32 *params) {
// can't right-click past the text for the first quarter second
right_click_delay = 3;
#ifdef _SWORD2_DEBUG
// Write to walkthrough file (zebug0.txt)
// if (player_id != george), then player is controlling Nico
// Oh, really? I thought Nico used the same object...
if (PLAYER_ID != CUR_PLAYER_ID)
Zdebug(0, "(%d) Nico: %s", officialTextNumber, text + 2);
debug(5, "(%d) Nico: %s", officialTextNumber, text + 2);
else
Zdebug(0, "(%d) %s: %s", officialTextNumber, FetchObjectName(ID), text + 2);
#endif
debug(5, "(%d) %s: %s", officialTextNumber, FetchObjectName(ID), text + 2);
// Set up the speech animation
@ -1222,9 +1209,7 @@ int32 FN_i_speak(int32 *params) {
// this next cycle, don't know yet)
g_sound->UnpauseSpeech();
} else {
#ifdef _SWORD2_DEBUG
Zdebug("ERROR: PlayCompSpeech(speechFile=\"%s\", wav=%d (res=%d pos=%d)) returned %.8x", speechFile, params[S_WAV], text_res, local_text, rv);
#endif
debug(5, "ERROR: PlayCompSpeech(speechFile=\"%s\", wav=%d (res=%d pos=%d)) returned %.8x", speechFile, params[S_WAV], text_res, local_text, rv);
}
}
@ -1576,8 +1561,7 @@ void Form_text(int32 *params) {
speech_time = strlen((char *) text) + 30;
} else {
// no text line passed? - this is bad
// Zdebug(9, "no text line for speech wav %d", params[S_WAV]);
Zdebug("no text line for speech wav %d", params[S_WAV]);
debug(5, "no text line for speech wav %d", params[S_WAV]);
}
}

View File

@ -66,10 +66,10 @@ uint32 Init_start_menu(void) {
total_startups = 0; // no starts
Zdebug("initialising start menu");
debug(5, "initialising start menu");
if (!(end = Read_file("startup.inf", &temp, UID_temp))) {
Zdebug("Init_start_menu cannot open startup.inf");
debug(5, "Init_start_menu cannot open startup.inf");
return 0; // meaning no start menu available
}
@ -96,7 +96,7 @@ uint32 Init_start_menu(void) {
total_screen_managers++;
if (total_screen_managers == MAX_starts) {
Zdebug("WARNING MAX_starts exceeded!");
debug(5, "WARNING MAX_starts exceeded!");
break;
}
} while (j <end);
@ -104,7 +104,7 @@ uint32 Init_start_menu(void) {
// using this method the Gode generated resource.inf must have #0d0a
// on the last entry
Zdebug("%d screen manager objects", total_screen_managers);
debug(5, "%d screen manager objects", total_screen_managers);
// Open each object and make a query call. The object must fill in a
// startup structure. It may fill in several if it wishes - for
@ -114,7 +114,7 @@ uint32 Init_start_menu(void) {
for (j = 0; j < total_screen_managers; j++) {
res = atoi(ascii_start_ids[j]);
Zdebug("+querying screen manager %d", res);
debug(5, "+querying screen manager %d", res);
// resopen each one and run through the interpretter
// script 0 is the query request script
@ -125,16 +125,15 @@ uint32 Init_start_menu(void) {
// start list
if (res_man.Res_check_valid(res)) {
Zdebug("- resource %d ok", res);
debug(5, "- resource %d ok", res);
raw_script = (char*) res_man.Res_open(res);
null_pc = 0;
RunScript(raw_script, raw_script, &null_pc);
res_man.Res_close(res);
} else
Zdebug("- resource %d invalid", res);
debug(5, "- resource %d invalid", res);
}
Zdebug(""); // line feed
Free_mem(temp); // release the Talloc
return 1;
@ -144,15 +143,15 @@ int32 FN_register_start_point(int32 *params) {
// params: 0 id of startup script to call - key
// 1 pointer to ascii message
// Zdebug(" FN_register_start_point %d %s", params[0], params[1]);
debug(5, " FN_register_start_point %d %s", params[0], params[1]);
#ifdef _SWORD2_DEBUG
if (total_startups == MAX_starts)
Con_fatal_error("ERROR: start_list full [%s line %u]", __FILE__, __LINE__);
Con_fatal_error("ERROR: start_list full");
// +1 to allow for NULL terminator
if (strlen((char*) params[1]) + 1 > MAX_description)
Con_fatal_error("ERROR: startup description too long [%s line %u]", __FILE__, __LINE__);
Con_fatal_error("ERROR: startup description too long");
#endif
// this objects id

View File

@ -132,65 +132,60 @@ int32 Sword2State::InitialiseGame(void) {
// get some falling RAM and put it in your pocket, never let it slip
// away
// Zdebug("CALLING: Init_memory_manager");
debug(5, "CALLING: Init_memory_manager");
Init_memory_manager();
// Zdebug("RETURNED.");
// initialise the resource manager
// Zdebug("CALLING: res_man.InitResMan");
debug(5, "CALLING: res_man.InitResMan");
res_man.InitResMan();
Zdebug("RETURNED from res_man.InitResMan");
// initialise global script variables
// res 1 is the globals list
file = res_man.Res_open(1);
// Zdebug("CALLING: SetGlobalInterpreterVariables");
debug(5, "CALLING: SetGlobalInterpreterVariables");
SetGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
// Zdebug("RETURNED.");
// DON'T CLOSE VARIABLES RESOURCE - KEEP IT OPEN AT VERY START OF
// MEMORY SO IT CAN'T MOVE!
// res_man.Res_close(1);
// DON'T CLOSE PLAYER OBJECT RESOURCE - KEEP IT OPEN IN MEMORY SO IT
// CAN'T MOVE!
file = res_man.Res_open(8);
// Set up font resource variables for this language version
// (James31july97)
// Zdebug("CALLING: InitialiseFontResourceFlags");
debug(5, "CALLING: InitialiseFontResourceFlags");
InitialiseFontResourceFlags();
// Also set the windows application name to the proper game name
// Zdebug("RETURNED.");
// set up the console system
// Zdebug("CALLING: Init_console");
debug(5, "CALLING: Init_console");
Init_console();
// Zdebug("RETURNED.");
#ifdef _SWORD2_DEBUG
// read in all the startup information
// Zdebug("CALLING: Init_start_menu");
debug(5, "CALLING: Init_start_menu");
Init_start_menu();
// Zdebug("RETURNED from Init_start_menu");
#endif
// no blocs live
// Zdebug("CALLING: Init_text_bloc_system");
debug(5, "CALLING: Init_text_bloc_system");
Init_text_bloc_system();
// Zdebug("RETURNED.");
// Zdebug("CALLING: Init_sync_system");
debug(5, "CALLING: Init_sync_system");
Init_sync_system();
// Zdebug("RETURNED.");
// Zdebug("CALLING: Init_event_system");
debug(5, "CALLING: Init_event_system");
Init_event_system();
// Zdebug("RETURNED.");
// initialise the sound fx queue
// Zdebug("CALLING: Init_fx_queue");
debug(5, "CALLING: Init_fx_queue");
Init_fx_queue();
// Zdebug("RETURNED.");
// all demos (not just web)
if (_gameId == GID_SWORD2_DEMO) {
@ -202,7 +197,7 @@ int32 Sword2State::InitialiseGame(void) {
}
void Close_game() {
// Zdebug("Close_game() STARTING:");
debug(5, "Close_game() STARTING:");
EraseBackBuffer();
// Stop music instantly!
@ -211,8 +206,6 @@ void Close_game() {
// free the memory again
Close_memory_manager();
res_man.Close_ResMan();
// Zdebug("Close_game() DONE.");
}
int32 GameCycle(void) {
@ -261,8 +254,6 @@ void Sword2State::go() {
uint8 breakOut = 0;
_keyboardEvent ke;
// Zdebug("[%s]", lpCmdLine);
// Call the application "Revolution" until the resource manager is
// ready to dig the name out of a text file. See InitialiseGame()
// which calls InitialiseFontResourceFlags() in maketext.cpp
@ -277,7 +268,7 @@ void Sword2State::go() {
_system->property(OSystem::PROP_SET_GFX_MODE, &prop);
}
// Zdebug("CALLING: InitialiseDisplay");
debug(5, "CALLING: InitialiseDisplay");
_system->init_size(640, 480);
rv = InitialiseDisplay(640, 480, 8, RD_FULLSCREEN);
@ -287,27 +278,21 @@ void Sword2State::go() {
_system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0);
}
// Zdebug("RETURNED with rv = %.8x", rv);
if (rv != RD_OK) {
// ReportDriverError(rv);
CloseAppWindow();
return;
}
// Zdebug("CALLING: ReadOptionSettings");
debug(5, "CALLING: ReadOptionSettings");
ReadOptionSettings(); //restore the menu settings
// Zdebug("RETURNED.");
// Zdebug("CALLING: InitialiseGame");
debug(5, "CALLING: InitialiseGame");
if (InitialiseGame()) {
Zdebug("RETURNED from InitialiseGame - closing game");
CloseAppWindow();
return;
}
// Zdebug("RETURNED from InitialiseGame - ok");
if (_saveSlot != -1) {
if (SaveExists(_saveSlot))
RestoreGame(_saveSlot);
@ -319,9 +304,8 @@ void Sword2State::go() {
} else
Start_game();
// Zdebug("CALLING: InitialiseRenderCycle");
debug(5, "CALLING: InitialiseRenderCycle");
InitialiseRenderCycle();
// Zdebug("RETURNED.");
while (1) {
ServiceWindows();
@ -449,7 +433,7 @@ void Sword2State::Start_game(void) {
int screen_manager_id;
Zdebug("Start_game() STARTING:");
debug(5, "Start_game() STARTING:");
// all demos not just web
if (_gameId == GID_SWORD2_DEMO)
@ -486,7 +470,7 @@ void Sword2State::Start_game(void) {
// close george
res_man.Res_close(8);
Zdebug("Start_game() DONE.");
debug(5, "Start_game() DONE.");
}
void PauseGame(void) {

View File

@ -26,7 +26,7 @@
typedef struct {
uint32 id;
uint32 sync;
} _sync_unit; // haaaaaaaa
} _sync_unit;
// there wont be many will there. probably 2 at most i reckon
#define MAX_syncs 10
@ -45,7 +45,7 @@ int32 FN_send_sync(int32 *params) {
for (int i = 0; i < MAX_syncs; i++) {
if (sync_list[i].id == 0) {
// Zdebug(" %d sending sync %d to %d", ID, params[1], params[0]);
debug(5, " %d sending sync %d to %d", ID, params[1], params[0]);
sync_list[i].id = params[0];
sync_list[i].sync = params[1];
return IR_CONT;
@ -67,7 +67,7 @@ void Clear_syncs(uint32 id) {
for (int i = 0; i < MAX_syncs; i++) {
if (sync_list[i].id == id) {
// Zdebug("removing sync %d for %d", i, id);
debug(5, "removing sync %d for %d", i, id);
sync_list[i].id = 0;
}
}
@ -111,12 +111,12 @@ int32 FN_wait_sync(int32 *params) {
// keep calling until a sync recieved
// params none
// Zdebug("%d waits", ID);
debug(5, "FN_wait_sync: %d waits", ID);
for (int i = 0; i < MAX_syncs; i++) {
if (sync_list[i].id == ID) {
// return sync value waiting
//Zdebug(" go");
debug(5, "FN_wait_sync: go");
RESULT = sync_list[i].sync;
return IR_CONT;
}

View File

@ -37,7 +37,7 @@ uint32 Read_file(const char *name, mem **membloc, uint32 uid) {
uint32 size;
if (!fh.open(name)) {
Zdebug("Read_file cannot open %s", name);
debug(5, "Read_file cannot open %s", name);
return 0;
}
@ -47,7 +47,7 @@ uint32 Read_file(const char *name, mem **membloc, uint32 uid) {
*membloc = Twalloc(size, MEM_float, uid);
if (fh.read((*membloc)->ad, size) != size) {
Zdebug("Read_file read fail %d", name);
debug(5, "Read_file read fail %d", name);
return 0;
}

View File

@ -99,7 +99,7 @@ int32 FN_walk(int32 *params) {
// invalid direction (NB. '8' means end walk on ANY direction)
if (params[6] < 0 || params[6] > 8)
Con_fatal_error("Invalid direction (%d) in FN_walk (%s line %u)", params[6], __FILE__, __LINE__);
Con_fatal_error("Invalid direction (%d) in FN_walk", params[6]);
ob_walkdata = (Object_walkdata *) params[3];
@ -290,11 +290,11 @@ int32 FN_walk_to_anim(int32 *params) {
pars[5] = standby_y;
pars[6] = standby_dir;
Zdebug("WARNING: FN_walk_to_anim(%s) used standby coords", FetchObjectName(params[4]));
debug(5, "WARNING: FN_walk_to_anim(%s) used standby coords", FetchObjectName(params[4]));
}
if (pars[6] < 0 || pars[6] > 7)
Con_fatal_error("Invalid direction (%d) in FN_walk_to_anim (%s line %u)", pars[6], __FILE__, __LINE__);
Con_fatal_error("Invalid direction (%d) in FN_walk_to_anim", pars[6]);
}
// set up the rest of the parameters for FN_walk()
@ -333,7 +333,7 @@ int32 FN_turn(int32 *params) {
if (ob_logic->looping == 0) {
if (params[4] < 0 || params[4] > 7)
Con_fatal_error("Invalid direction (%d) in FN_turn (%s line %u)", params[4], __FILE__, __LINE__);
Con_fatal_error("Invalid direction (%d) in FN_turn", params[4]);
ob_mega = (Object_mega *) params[2];
@ -370,7 +370,7 @@ int32 FN_stand_at(int32 *params) {
// check for invalid direction
if (params[4] < 0 || params[4] > 7)
Con_fatal_error("Invalid direction (%d) in FN_stand_at (%s line %u)", params[4], __FILE__, __LINE__);
Con_fatal_error("Invalid direction (%d) in FN_stand_at", params[4]);
// set up pointers to the graphic & mega structure
@ -448,11 +448,11 @@ int32 FN_stand_after_anim(int32 *params) {
pars[3] = standby_y;
pars[4] = standby_dir;
Zdebug("WARNING: FN_stand_after_anim(%s) used standby coords", FetchObjectName(params[2]));
debug(5, "WARNING: FN_stand_after_anim(%s) used standby coords", FetchObjectName(params[2]));
}
if (pars[4] < 0 || pars[4] > 7)
Con_fatal_error("Invalid direction (%d) in FN_stand_after_anim (%s line %u)", pars[4], __FILE__, __LINE__);
Con_fatal_error("Invalid direction (%d) in FN_stand_after_anim", pars[4]);
// close the anim file
res_man.Res_close(params[2]);
@ -495,11 +495,11 @@ int32 FN_stand_at_anim(int32 *params) {
pars[3] = standby_y;
pars[4] = standby_dir;
Zdebug("WARNING: FN_stand_at_anim(%s) used standby coords", FetchObjectName(params[2]));
debug(5, "WARNING: FN_stand_at_anim(%s) used standby coords", FetchObjectName(params[2]));
}
if (pars[4] < 0 || pars[4] > 7)
Con_fatal_error("Invalid direction (%d) in FN_stand_after_anim (%s line %u)", pars[4], __FILE__, __LINE__);
Con_fatal_error("Invalid direction (%d) in FN_stand_after_anim", pars[4]);
// close the anim file
res_man.Res_close(params[2]);
@ -689,8 +689,8 @@ int32 FN_walk_to_talk_to_mega(int32 *params) {
mega_seperation= (mega_seperation * scale) / 256;
// Zdebug("seperation %d", mega_seperation);
// Zdebug(" target x %d, y %d", engine_mega.feet_x, engine_mega.feet_y);
debug(5, "seperation %d", mega_seperation);
debug(5, " target x %d, y %d", engine_mega.feet_x, engine_mega.feet_y);
if (engine_mega.feet_x < ob_mega->feet_x)
{
@ -790,7 +790,7 @@ int32 FN_set_standby_coords(int32 *params) {
// 2 direction (0..7)
if (params[2] < 0 || params[2] > 7)
Con_fatal_error("Invalid direction (%d) in FN_set_standby_coords (%s line %u)", params[2], __FILE__, __LINE__);
Con_fatal_error("Invalid direction (%d) in FN_set_standby_coords", params[2]);
standby_x = (int16) params[0];
standby_y = (int16) params[1];