Convert files from CRLF to LF line endings.
This commit is contained in:
parent
2e1a244af4
commit
c996c125b7
6 changed files with 2478 additions and 2478 deletions
|
|
@ -1,356 +1,356 @@
|
|||
/*
|
||||
|
||||
Copyright(C) 2005-2014 Simon Howard
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
--
|
||||
|
||||
Functions for presenting the information captured from the statistics
|
||||
buffer to a file.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "d_player.h"
|
||||
#include "d_mode.h"
|
||||
#include "m_argv.h"
|
||||
|
||||
#include "statdump.h"
|
||||
|
||||
/* Par times for E1M1-E1M9. */
|
||||
static const int doom1_par_times[] =
|
||||
{
|
||||
30, 75, 120, 90, 165, 180, 180, 30, 165,
|
||||
};
|
||||
|
||||
/* Par times for MAP01-MAP09. */
|
||||
static const int doom2_par_times[] =
|
||||
{
|
||||
30, 90, 120, 120, 90, 150, 120, 120, 270,
|
||||
};
|
||||
|
||||
/* Player colors. */
|
||||
static const char *player_colors[] =
|
||||
{
|
||||
"Green", "Indigo", "Brown", "Red"
|
||||
};
|
||||
|
||||
// Array of end-of-level statistics that have been captured.
|
||||
|
||||
#define MAX_CAPTURES 32
|
||||
static wbstartstruct_t captured_stats[MAX_CAPTURES];
|
||||
static int num_captured_stats = 0;
|
||||
|
||||
static GameMission_t discovered_gamemission = none;
|
||||
|
||||
/* Try to work out whether this is a Doom 1 or Doom 2 game, by looking
|
||||
* at the episode and map, and the par times. This is used to decide
|
||||
* how to format the level name. Unfortunately, in some cases it is
|
||||
* impossible to determine whether this is Doom 1 or Doom 2. */
|
||||
|
||||
static void DiscoverGamemode(wbstartstruct_t *stats, int num_stats)
|
||||
{
|
||||
int partime;
|
||||
int level;
|
||||
int i;
|
||||
|
||||
if (discovered_gamemission != none)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0; i<num_stats; ++i)
|
||||
{
|
||||
level = stats[i].last;
|
||||
|
||||
/* If episode 2, 3 or 4, this is Doom 1. */
|
||||
|
||||
if (stats[i].epsd > 0)
|
||||
{
|
||||
discovered_gamemission = doom;
|
||||
return;
|
||||
}
|
||||
|
||||
/* This is episode 1. If this is level 10 or higher,
|
||||
it must be Doom 2. */
|
||||
|
||||
if (level >= 9)
|
||||
{
|
||||
discovered_gamemission = doom2;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Try to work out if this is Doom 1 or Doom 2 by looking
|
||||
at the par time. */
|
||||
|
||||
partime = stats[i].partime;
|
||||
|
||||
if (partime == doom1_par_times[level] * TICRATE
|
||||
&& partime != doom2_par_times[level] * TICRATE)
|
||||
{
|
||||
discovered_gamemission = doom;
|
||||
return;
|
||||
}
|
||||
|
||||
if (partime != doom1_par_times[level] * TICRATE
|
||||
&& partime == doom2_par_times[level] * TICRATE)
|
||||
{
|
||||
discovered_gamemission = doom2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the number of players active in the given stats buffer. */
|
||||
|
||||
static int GetNumPlayers(wbstartstruct_t *stats)
|
||||
{
|
||||
int i;
|
||||
int num_players = 0;
|
||||
|
||||
for (i=0; i<MAXPLAYERS; ++i)
|
||||
{
|
||||
if (stats->plyr[i].in)
|
||||
{
|
||||
++num_players;
|
||||
}
|
||||
}
|
||||
|
||||
return num_players;
|
||||
}
|
||||
|
||||
static void PrintBanner(FILE *stream)
|
||||
{
|
||||
fprintf(stream, "===========================================\n");
|
||||
}
|
||||
|
||||
static void PrintPercentage(FILE *stream, int amount, int total)
|
||||
{
|
||||
if (total == 0)
|
||||
{
|
||||
fprintf(stream, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stream, "%i / %i", amount, total);
|
||||
|
||||
// statdump.exe is a 16-bit program, so very occasionally an
|
||||
// integer overflow can occur when doing this calculation with
|
||||
// a large value. Therefore, cast to short to give the same
|
||||
// output.
|
||||
|
||||
fprintf(stream, " (%i%%)", (short) (amount * 100) / total);
|
||||
}
|
||||
}
|
||||
|
||||
/* Display statistics for a single player. */
|
||||
|
||||
static void PrintPlayerStats(FILE *stream, wbstartstruct_t *stats,
|
||||
int player_num)
|
||||
{
|
||||
wbplayerstruct_t *player = &stats->plyr[player_num];
|
||||
|
||||
fprintf(stream, "Player %i (%s):\n", player_num + 1,
|
||||
player_colors[player_num]);
|
||||
|
||||
/* Kills percentage */
|
||||
|
||||
fprintf(stream, "\tKills: ");
|
||||
PrintPercentage(stream, player->skills, stats->maxkills);
|
||||
fprintf(stream, "\n");
|
||||
|
||||
/* Items percentage */
|
||||
|
||||
fprintf(stream, "\tItems: ");
|
||||
PrintPercentage(stream, player->sitems, stats->maxitems);
|
||||
fprintf(stream, "\n");
|
||||
|
||||
/* Secrets percentage */
|
||||
|
||||
fprintf(stream, "\tSecrets: ");
|
||||
PrintPercentage(stream, player->ssecret, stats->maxsecret);
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
/* Frags table for multiplayer games. */
|
||||
|
||||
static void PrintFragsTable(FILE *stream, wbstartstruct_t *stats)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
fprintf(stream, "Frags:\n");
|
||||
|
||||
/* Print header */
|
||||
|
||||
fprintf(stream, "\t\t");
|
||||
|
||||
for (x=0; x<MAXPLAYERS; ++x)
|
||||
{
|
||||
|
||||
if (!stats->plyr[x].in)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stream, "%s\t", player_colors[x]);
|
||||
}
|
||||
|
||||
fprintf(stream, "\n");
|
||||
|
||||
fprintf(stream, "\t\t-------------------------------- VICTIMS\n");
|
||||
|
||||
/* Print table */
|
||||
|
||||
for (y=0; y<MAXPLAYERS; ++y)
|
||||
{
|
||||
if (!stats->plyr[y].in)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stream, "\t%s\t|", player_colors[y]);
|
||||
|
||||
for (x=0; x<MAXPLAYERS; ++x)
|
||||
{
|
||||
if (!stats->plyr[x].in)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stream, "%i\t", stats->plyr[y].frags[x]);
|
||||
}
|
||||
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
fprintf(stream, "\t\t|\n");
|
||||
fprintf(stream, "\t KILLERS\n");
|
||||
}
|
||||
|
||||
/* Displays the level name: MAPxy or ExMy, depending on game mode. */
|
||||
|
||||
static void PrintLevelName(FILE *stream, int episode, int level)
|
||||
{
|
||||
PrintBanner(stream);
|
||||
|
||||
switch (discovered_gamemission)
|
||||
{
|
||||
|
||||
case doom:
|
||||
fprintf(stream, "E%iM%i\n", episode + 1, level + 1);
|
||||
break;
|
||||
case doom2:
|
||||
fprintf(stream, "MAP%02i\n", level + 1);
|
||||
break;
|
||||
default:
|
||||
case none:
|
||||
fprintf(stream, "E%iM%i / MAP%02i\n",
|
||||
episode + 1, level + 1, level + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
PrintBanner(stream);
|
||||
}
|
||||
|
||||
/* Print details of a statistics buffer to the given file. */
|
||||
|
||||
static void PrintStats(FILE *stream, wbstartstruct_t *stats)
|
||||
{
|
||||
int leveltime, partime;
|
||||
int i;
|
||||
|
||||
PrintLevelName(stream, stats->epsd, stats->last);
|
||||
fprintf(stream, "\n");
|
||||
|
||||
leveltime = stats->plyr[0].stime / TICRATE;
|
||||
partime = stats->partime / TICRATE;
|
||||
fprintf(stream, "Time: %i:%02i", leveltime / 60, leveltime % 60);
|
||||
fprintf(stream, " (par: %i:%02i)\n", partime / 60, partime % 60);
|
||||
fprintf(stream, "\n");
|
||||
|
||||
for (i=0; i<MAXPLAYERS; ++i)
|
||||
{
|
||||
if (stats->plyr[i].in)
|
||||
{
|
||||
PrintPlayerStats(stream, stats, i);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetNumPlayers(stats) >= 2)
|
||||
{
|
||||
PrintFragsTable(stream, stats);
|
||||
}
|
||||
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
void StatCopy(wbstartstruct_t *stats)
|
||||
{
|
||||
if (M_ParmExists("-statdump") && num_captured_stats < MAX_CAPTURES)
|
||||
{
|
||||
memcpy(&captured_stats[num_captured_stats], stats,
|
||||
sizeof(wbstartstruct_t));
|
||||
++num_captured_stats;
|
||||
}
|
||||
}
|
||||
|
||||
void StatDump(void)
|
||||
{
|
||||
FILE *dumpfile;
|
||||
int i;
|
||||
|
||||
//!
|
||||
// @category compat
|
||||
// @arg <filename>
|
||||
//
|
||||
// Dump statistics information to the specified file on the levels
|
||||
// that were played. The output from this option matches the output
|
||||
// from statdump.exe (see ctrlapi.zip in the /idgames archive).
|
||||
//
|
||||
|
||||
i = M_CheckParmWithArgs("-statdump", 1);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
printf("Statistics captured for %i level(s)\n", num_captured_stats);
|
||||
|
||||
// We actually know what the real gamemission is, but this has
|
||||
// to match the output from statdump.exe.
|
||||
|
||||
DiscoverGamemode(captured_stats, num_captured_stats);
|
||||
|
||||
// Allow "-" as output file, for stdout.
|
||||
|
||||
if (strcmp(myargv[i + 1], "-") != 0)
|
||||
{
|
||||
dumpfile = fopen(myargv[i + 1], "w");
|
||||
}
|
||||
else
|
||||
{
|
||||
dumpfile = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_captured_stats; ++i)
|
||||
{
|
||||
PrintStats(dumpfile, &captured_stats[i]);
|
||||
}
|
||||
|
||||
if (dumpfile != NULL)
|
||||
{
|
||||
fclose(dumpfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Copyright(C) 2005-2014 Simon Howard
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
--
|
||||
|
||||
Functions for presenting the information captured from the statistics
|
||||
buffer to a file.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "d_player.h"
|
||||
#include "d_mode.h"
|
||||
#include "m_argv.h"
|
||||
|
||||
#include "statdump.h"
|
||||
|
||||
/* Par times for E1M1-E1M9. */
|
||||
static const int doom1_par_times[] =
|
||||
{
|
||||
30, 75, 120, 90, 165, 180, 180, 30, 165,
|
||||
};
|
||||
|
||||
/* Par times for MAP01-MAP09. */
|
||||
static const int doom2_par_times[] =
|
||||
{
|
||||
30, 90, 120, 120, 90, 150, 120, 120, 270,
|
||||
};
|
||||
|
||||
/* Player colors. */
|
||||
static const char *player_colors[] =
|
||||
{
|
||||
"Green", "Indigo", "Brown", "Red"
|
||||
};
|
||||
|
||||
// Array of end-of-level statistics that have been captured.
|
||||
|
||||
#define MAX_CAPTURES 32
|
||||
static wbstartstruct_t captured_stats[MAX_CAPTURES];
|
||||
static int num_captured_stats = 0;
|
||||
|
||||
static GameMission_t discovered_gamemission = none;
|
||||
|
||||
/* Try to work out whether this is a Doom 1 or Doom 2 game, by looking
|
||||
* at the episode and map, and the par times. This is used to decide
|
||||
* how to format the level name. Unfortunately, in some cases it is
|
||||
* impossible to determine whether this is Doom 1 or Doom 2. */
|
||||
|
||||
static void DiscoverGamemode(wbstartstruct_t *stats, int num_stats)
|
||||
{
|
||||
int partime;
|
||||
int level;
|
||||
int i;
|
||||
|
||||
if (discovered_gamemission != none)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0; i<num_stats; ++i)
|
||||
{
|
||||
level = stats[i].last;
|
||||
|
||||
/* If episode 2, 3 or 4, this is Doom 1. */
|
||||
|
||||
if (stats[i].epsd > 0)
|
||||
{
|
||||
discovered_gamemission = doom;
|
||||
return;
|
||||
}
|
||||
|
||||
/* This is episode 1. If this is level 10 or higher,
|
||||
it must be Doom 2. */
|
||||
|
||||
if (level >= 9)
|
||||
{
|
||||
discovered_gamemission = doom2;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Try to work out if this is Doom 1 or Doom 2 by looking
|
||||
at the par time. */
|
||||
|
||||
partime = stats[i].partime;
|
||||
|
||||
if (partime == doom1_par_times[level] * TICRATE
|
||||
&& partime != doom2_par_times[level] * TICRATE)
|
||||
{
|
||||
discovered_gamemission = doom;
|
||||
return;
|
||||
}
|
||||
|
||||
if (partime != doom1_par_times[level] * TICRATE
|
||||
&& partime == doom2_par_times[level] * TICRATE)
|
||||
{
|
||||
discovered_gamemission = doom2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the number of players active in the given stats buffer. */
|
||||
|
||||
static int GetNumPlayers(wbstartstruct_t *stats)
|
||||
{
|
||||
int i;
|
||||
int num_players = 0;
|
||||
|
||||
for (i=0; i<MAXPLAYERS; ++i)
|
||||
{
|
||||
if (stats->plyr[i].in)
|
||||
{
|
||||
++num_players;
|
||||
}
|
||||
}
|
||||
|
||||
return num_players;
|
||||
}
|
||||
|
||||
static void PrintBanner(FILE *stream)
|
||||
{
|
||||
fprintf(stream, "===========================================\n");
|
||||
}
|
||||
|
||||
static void PrintPercentage(FILE *stream, int amount, int total)
|
||||
{
|
||||
if (total == 0)
|
||||
{
|
||||
fprintf(stream, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stream, "%i / %i", amount, total);
|
||||
|
||||
// statdump.exe is a 16-bit program, so very occasionally an
|
||||
// integer overflow can occur when doing this calculation with
|
||||
// a large value. Therefore, cast to short to give the same
|
||||
// output.
|
||||
|
||||
fprintf(stream, " (%i%%)", (short) (amount * 100) / total);
|
||||
}
|
||||
}
|
||||
|
||||
/* Display statistics for a single player. */
|
||||
|
||||
static void PrintPlayerStats(FILE *stream, wbstartstruct_t *stats,
|
||||
int player_num)
|
||||
{
|
||||
wbplayerstruct_t *player = &stats->plyr[player_num];
|
||||
|
||||
fprintf(stream, "Player %i (%s):\n", player_num + 1,
|
||||
player_colors[player_num]);
|
||||
|
||||
/* Kills percentage */
|
||||
|
||||
fprintf(stream, "\tKills: ");
|
||||
PrintPercentage(stream, player->skills, stats->maxkills);
|
||||
fprintf(stream, "\n");
|
||||
|
||||
/* Items percentage */
|
||||
|
||||
fprintf(stream, "\tItems: ");
|
||||
PrintPercentage(stream, player->sitems, stats->maxitems);
|
||||
fprintf(stream, "\n");
|
||||
|
||||
/* Secrets percentage */
|
||||
|
||||
fprintf(stream, "\tSecrets: ");
|
||||
PrintPercentage(stream, player->ssecret, stats->maxsecret);
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
/* Frags table for multiplayer games. */
|
||||
|
||||
static void PrintFragsTable(FILE *stream, wbstartstruct_t *stats)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
fprintf(stream, "Frags:\n");
|
||||
|
||||
/* Print header */
|
||||
|
||||
fprintf(stream, "\t\t");
|
||||
|
||||
for (x=0; x<MAXPLAYERS; ++x)
|
||||
{
|
||||
|
||||
if (!stats->plyr[x].in)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stream, "%s\t", player_colors[x]);
|
||||
}
|
||||
|
||||
fprintf(stream, "\n");
|
||||
|
||||
fprintf(stream, "\t\t-------------------------------- VICTIMS\n");
|
||||
|
||||
/* Print table */
|
||||
|
||||
for (y=0; y<MAXPLAYERS; ++y)
|
||||
{
|
||||
if (!stats->plyr[y].in)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stream, "\t%s\t|", player_colors[y]);
|
||||
|
||||
for (x=0; x<MAXPLAYERS; ++x)
|
||||
{
|
||||
if (!stats->plyr[x].in)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stream, "%i\t", stats->plyr[y].frags[x]);
|
||||
}
|
||||
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
fprintf(stream, "\t\t|\n");
|
||||
fprintf(stream, "\t KILLERS\n");
|
||||
}
|
||||
|
||||
/* Displays the level name: MAPxy or ExMy, depending on game mode. */
|
||||
|
||||
static void PrintLevelName(FILE *stream, int episode, int level)
|
||||
{
|
||||
PrintBanner(stream);
|
||||
|
||||
switch (discovered_gamemission)
|
||||
{
|
||||
|
||||
case doom:
|
||||
fprintf(stream, "E%iM%i\n", episode + 1, level + 1);
|
||||
break;
|
||||
case doom2:
|
||||
fprintf(stream, "MAP%02i\n", level + 1);
|
||||
break;
|
||||
default:
|
||||
case none:
|
||||
fprintf(stream, "E%iM%i / MAP%02i\n",
|
||||
episode + 1, level + 1, level + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
PrintBanner(stream);
|
||||
}
|
||||
|
||||
/* Print details of a statistics buffer to the given file. */
|
||||
|
||||
static void PrintStats(FILE *stream, wbstartstruct_t *stats)
|
||||
{
|
||||
int leveltime, partime;
|
||||
int i;
|
||||
|
||||
PrintLevelName(stream, stats->epsd, stats->last);
|
||||
fprintf(stream, "\n");
|
||||
|
||||
leveltime = stats->plyr[0].stime / TICRATE;
|
||||
partime = stats->partime / TICRATE;
|
||||
fprintf(stream, "Time: %i:%02i", leveltime / 60, leveltime % 60);
|
||||
fprintf(stream, " (par: %i:%02i)\n", partime / 60, partime % 60);
|
||||
fprintf(stream, "\n");
|
||||
|
||||
for (i=0; i<MAXPLAYERS; ++i)
|
||||
{
|
||||
if (stats->plyr[i].in)
|
||||
{
|
||||
PrintPlayerStats(stream, stats, i);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetNumPlayers(stats) >= 2)
|
||||
{
|
||||
PrintFragsTable(stream, stats);
|
||||
}
|
||||
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
void StatCopy(wbstartstruct_t *stats)
|
||||
{
|
||||
if (M_ParmExists("-statdump") && num_captured_stats < MAX_CAPTURES)
|
||||
{
|
||||
memcpy(&captured_stats[num_captured_stats], stats,
|
||||
sizeof(wbstartstruct_t));
|
||||
++num_captured_stats;
|
||||
}
|
||||
}
|
||||
|
||||
void StatDump(void)
|
||||
{
|
||||
FILE *dumpfile;
|
||||
int i;
|
||||
|
||||
//!
|
||||
// @category compat
|
||||
// @arg <filename>
|
||||
//
|
||||
// Dump statistics information to the specified file on the levels
|
||||
// that were played. The output from this option matches the output
|
||||
// from statdump.exe (see ctrlapi.zip in the /idgames archive).
|
||||
//
|
||||
|
||||
i = M_CheckParmWithArgs("-statdump", 1);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
printf("Statistics captured for %i level(s)\n", num_captured_stats);
|
||||
|
||||
// We actually know what the real gamemission is, but this has
|
||||
// to match the output from statdump.exe.
|
||||
|
||||
DiscoverGamemode(captured_stats, num_captured_stats);
|
||||
|
||||
// Allow "-" as output file, for stdout.
|
||||
|
||||
if (strcmp(myargv[i + 1], "-") != 0)
|
||||
{
|
||||
dumpfile = fopen(myargv[i + 1], "w");
|
||||
}
|
||||
else
|
||||
{
|
||||
dumpfile = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_captured_stats; ++i)
|
||||
{
|
||||
PrintStats(dumpfile, &captured_stats[i]);
|
||||
}
|
||||
|
||||
if (dumpfile != NULL)
|
||||
{
|
||||
fclose(dumpfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
/*
|
||||
|
||||
Copyright(C) 2005-2014 Simon Howard
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DOOM_STATDUMP_H
|
||||
#define DOOM_STATDUMP_H
|
||||
|
||||
void StatCopy(wbstartstruct_t *stats);
|
||||
void StatDump(void);
|
||||
|
||||
#endif /* #ifndef DOOM_STATDUMP_H */
|
||||
/*
|
||||
|
||||
Copyright(C) 2005-2014 Simon Howard
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DOOM_STATDUMP_H
|
||||
#define DOOM_STATDUMP_H
|
||||
|
||||
void StatCopy(wbstartstruct_t *stats);
|
||||
void StatDump(void);
|
||||
|
||||
#endif /* #ifndef DOOM_STATDUMP_H */
|
||||
|
|
|
|||
1056
src/strife/m_saves.c
1056
src/strife/m_saves.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,56 +1,56 @@
|
|||
//
|
||||
// Copyright(C) 1993-1996 Id Software, Inc.
|
||||
// Copyright(C) 2010 James Haley, Samuel Villareal
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// [STRIFE] New Module
|
||||
//
|
||||
// Strife Hub Saving Code
|
||||
//
|
||||
|
||||
#ifndef M_SAVES_H__
|
||||
#define M_SAVES_H__
|
||||
|
||||
#define CHARACTER_NAME_LEN 32
|
||||
|
||||
extern char *savepath;
|
||||
extern char *savepathtemp;
|
||||
extern char *loadpath;
|
||||
extern char character_name[CHARACTER_NAME_LEN];
|
||||
|
||||
// Strife Savegame Functions
|
||||
void ClearTmp(void);
|
||||
void ClearSlot(void);
|
||||
void FromCurr(void);
|
||||
void ToCurr(void);
|
||||
void M_SaveMoveMapToHere(void);
|
||||
void M_SaveMoveHereToMap(void);
|
||||
|
||||
boolean M_SaveMisObj(const char *path);
|
||||
void M_ReadMisObj(void);
|
||||
|
||||
// Custom Utilities for Filepath Handling
|
||||
void *M_Calloc(size_t n1, size_t n2);
|
||||
void M_NormalizeSlashes(char *str);
|
||||
int M_StringAlloc(char **str, int numstrs, size_t extra, const char *str1, ...);
|
||||
char *M_SafeFilePath(const char *basepath, const char *newcomponent);
|
||||
char M_GetFilePath(const char *fn, char *dest, size_t len);
|
||||
char *M_MakeStrifeSaveDir(int slotnum, const char *extra);
|
||||
void M_CreateSaveDirs(const char *savedir);
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
||||
|
||||
|
||||
//
|
||||
// Copyright(C) 1993-1996 Id Software, Inc.
|
||||
// Copyright(C) 2010 James Haley, Samuel Villareal
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// [STRIFE] New Module
|
||||
//
|
||||
// Strife Hub Saving Code
|
||||
//
|
||||
|
||||
#ifndef M_SAVES_H__
|
||||
#define M_SAVES_H__
|
||||
|
||||
#define CHARACTER_NAME_LEN 32
|
||||
|
||||
extern char *savepath;
|
||||
extern char *savepathtemp;
|
||||
extern char *loadpath;
|
||||
extern char character_name[CHARACTER_NAME_LEN];
|
||||
|
||||
// Strife Savegame Functions
|
||||
void ClearTmp(void);
|
||||
void ClearSlot(void);
|
||||
void FromCurr(void);
|
||||
void ToCurr(void);
|
||||
void M_SaveMoveMapToHere(void);
|
||||
void M_SaveMoveHereToMap(void);
|
||||
|
||||
boolean M_SaveMisObj(const char *path);
|
||||
void M_ReadMisObj(void);
|
||||
|
||||
// Custom Utilities for Filepath Handling
|
||||
void *M_Calloc(size_t n1, size_t n2);
|
||||
void M_NormalizeSlashes(char *str);
|
||||
int M_StringAlloc(char **str, int numstrs, size_t extra, const char *str1, ...);
|
||||
char *M_SafeFilePath(const char *basepath, const char *newcomponent);
|
||||
char M_GetFilePath(const char *fn, char *dest, size_t len);
|
||||
char *M_MakeStrifeSaveDir(int slotnum, const char *extra);
|
||||
void M_CreateSaveDirs(const char *savedir);
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,102 +1,102 @@
|
|||
//
|
||||
// Copyright(C) 1993-1996 Id Software, Inc.
|
||||
// Copyright(C) 1996 Rogue Entertainment / Velocity, Inc.
|
||||
// Copyright(C) 2010 James Haley, Samuel Villareal
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// [STRIFE] New Module
|
||||
//
|
||||
// Dialog Engine for Strife
|
||||
//
|
||||
|
||||
#ifndef P_DIALOG_H__
|
||||
#define P_DIALOG_H__
|
||||
|
||||
#define OBJECTIVE_LEN 300
|
||||
|
||||
#define MAXINVENTORYSLOTS 30
|
||||
|
||||
#define MDLG_CHOICELEN 32
|
||||
#define MDLG_MSGLEN 80
|
||||
#define MDLG_NAMELEN 16
|
||||
#define MDLG_LUMPLEN 8
|
||||
#define MDLG_TEXTLEN 320
|
||||
#define MDLG_MAXCHOICES 5
|
||||
#define MDLG_MAXITEMS 3
|
||||
|
||||
extern char mission_objective[OBJECTIVE_LEN];
|
||||
|
||||
extern int dialogshowtext;
|
||||
|
||||
// villsa - convenient macro for giving objective logs to player
|
||||
#define GiveObjective(x, minlumpnum) \
|
||||
do { \
|
||||
int obj_ln = W_CheckNumForName(DEH_String(x)); \
|
||||
if(obj_ln > minlumpnum) \
|
||||
M_StringCopy(mission_objective, W_CacheLumpNum(obj_ln, PU_CACHE), \
|
||||
OBJECTIVE_LEN);\
|
||||
} while(0)
|
||||
|
||||
// haleyjd - voice and objective in one
|
||||
#define GiveVoiceObjective(voice, log, minlumpnum) \
|
||||
do { \
|
||||
int obj_ln = W_CheckNumForName(DEH_String(log)); \
|
||||
I_StartVoice(DEH_String(voice)); \
|
||||
if(obj_ln > minlumpnum) \
|
||||
M_StringCopy(mission_objective, W_CacheLumpNum(obj_ln, PU_CACHE), \
|
||||
OBJECTIVE_LEN);\
|
||||
} while(0)
|
||||
|
||||
typedef struct mapdlgchoice_s
|
||||
{
|
||||
int giveitem; // item given when successful
|
||||
int needitems[MDLG_MAXITEMS]; // item needed for success
|
||||
int needamounts[MDLG_MAXITEMS]; // amount of items needed
|
||||
char text[MDLG_CHOICELEN]; // normal text
|
||||
char textok[MDLG_MSGLEN]; // message given on success
|
||||
int next; // next dialog?
|
||||
int objective; // ???
|
||||
char textno[MDLG_MSGLEN]; // message given on failure
|
||||
} mapdlgchoice_t;
|
||||
|
||||
typedef struct mapdialog_s
|
||||
{
|
||||
int speakerid; // script ID# for mobjtype that will use this dialog
|
||||
int dropitem; // item to drop if that thingtype is killed
|
||||
int checkitem[MDLG_MAXITEMS]; // item(s) needed to see this dialog
|
||||
int jumptoconv; // conversation to jump to when... ?
|
||||
char name[MDLG_NAMELEN]; // name of speaker
|
||||
char voice[MDLG_LUMPLEN]; // voice file to play
|
||||
char backpic[MDLG_LUMPLEN]; // backdrop pic for character, if any
|
||||
char text[MDLG_TEXTLEN]; // main message text
|
||||
|
||||
// options that this dialog gives the player
|
||||
mapdlgchoice_t choices[MDLG_MAXCHOICES];
|
||||
} mapdialog_t;
|
||||
|
||||
void P_DialogLoad(void);
|
||||
void P_DialogStart(player_t *player);
|
||||
void P_DialogDoChoice(int choice);
|
||||
boolean P_GiveItemToPlayer(player_t *player, int sprnum, mobjtype_t type);
|
||||
boolean P_GiveInventoryItem(player_t *player, int sprnum, mobjtype_t type);
|
||||
boolean P_UseInventoryItem(player_t* player, int item);
|
||||
void P_DialogStartP1(void);
|
||||
mapdialog_t* P_DialogFind(mobjtype_t type, int jumptoconv);
|
||||
int P_PlayerHasItem(player_t *player, mobjtype_t type);
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
||||
|
||||
|
||||
//
|
||||
// Copyright(C) 1993-1996 Id Software, Inc.
|
||||
// Copyright(C) 1996 Rogue Entertainment / Velocity, Inc.
|
||||
// Copyright(C) 2010 James Haley, Samuel Villareal
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// [STRIFE] New Module
|
||||
//
|
||||
// Dialog Engine for Strife
|
||||
//
|
||||
|
||||
#ifndef P_DIALOG_H__
|
||||
#define P_DIALOG_H__
|
||||
|
||||
#define OBJECTIVE_LEN 300
|
||||
|
||||
#define MAXINVENTORYSLOTS 30
|
||||
|
||||
#define MDLG_CHOICELEN 32
|
||||
#define MDLG_MSGLEN 80
|
||||
#define MDLG_NAMELEN 16
|
||||
#define MDLG_LUMPLEN 8
|
||||
#define MDLG_TEXTLEN 320
|
||||
#define MDLG_MAXCHOICES 5
|
||||
#define MDLG_MAXITEMS 3
|
||||
|
||||
extern char mission_objective[OBJECTIVE_LEN];
|
||||
|
||||
extern int dialogshowtext;
|
||||
|
||||
// villsa - convenient macro for giving objective logs to player
|
||||
#define GiveObjective(x, minlumpnum) \
|
||||
do { \
|
||||
int obj_ln = W_CheckNumForName(DEH_String(x)); \
|
||||
if(obj_ln > minlumpnum) \
|
||||
M_StringCopy(mission_objective, W_CacheLumpNum(obj_ln, PU_CACHE), \
|
||||
OBJECTIVE_LEN);\
|
||||
} while(0)
|
||||
|
||||
// haleyjd - voice and objective in one
|
||||
#define GiveVoiceObjective(voice, log, minlumpnum) \
|
||||
do { \
|
||||
int obj_ln = W_CheckNumForName(DEH_String(log)); \
|
||||
I_StartVoice(DEH_String(voice)); \
|
||||
if(obj_ln > minlumpnum) \
|
||||
M_StringCopy(mission_objective, W_CacheLumpNum(obj_ln, PU_CACHE), \
|
||||
OBJECTIVE_LEN);\
|
||||
} while(0)
|
||||
|
||||
typedef struct mapdlgchoice_s
|
||||
{
|
||||
int giveitem; // item given when successful
|
||||
int needitems[MDLG_MAXITEMS]; // item needed for success
|
||||
int needamounts[MDLG_MAXITEMS]; // amount of items needed
|
||||
char text[MDLG_CHOICELEN]; // normal text
|
||||
char textok[MDLG_MSGLEN]; // message given on success
|
||||
int next; // next dialog?
|
||||
int objective; // ???
|
||||
char textno[MDLG_MSGLEN]; // message given on failure
|
||||
} mapdlgchoice_t;
|
||||
|
||||
typedef struct mapdialog_s
|
||||
{
|
||||
int speakerid; // script ID# for mobjtype that will use this dialog
|
||||
int dropitem; // item to drop if that thingtype is killed
|
||||
int checkitem[MDLG_MAXITEMS]; // item(s) needed to see this dialog
|
||||
int jumptoconv; // conversation to jump to when... ?
|
||||
char name[MDLG_NAMELEN]; // name of speaker
|
||||
char voice[MDLG_LUMPLEN]; // voice file to play
|
||||
char backpic[MDLG_LUMPLEN]; // backdrop pic for character, if any
|
||||
char text[MDLG_TEXTLEN]; // main message text
|
||||
|
||||
// options that this dialog gives the player
|
||||
mapdlgchoice_t choices[MDLG_MAXCHOICES];
|
||||
} mapdialog_t;
|
||||
|
||||
void P_DialogLoad(void);
|
||||
void P_DialogStart(player_t *player);
|
||||
void P_DialogDoChoice(int choice);
|
||||
boolean P_GiveItemToPlayer(player_t *player, int sprnum, mobjtype_t type);
|
||||
boolean P_GiveInventoryItem(player_t *player, int sprnum, mobjtype_t type);
|
||||
boolean P_UseInventoryItem(player_t* player, int item);
|
||||
void P_DialogStartP1(void);
|
||||
mapdialog_t* P_DialogFind(mobjtype_t type, int jumptoconv);
|
||||
int P_PlayerHasItem(player_t *player, mobjtype_t type);
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue