Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/game/museum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ void Mission_Data_Buttons(char plr, int *where)
char index, yr, season, j, temp = 0;

auto launchReview = [](int plr, int index, int *where) {
Draw_Mis_Stats(plr, index, where, 0);
Draw_Mis_Stats(plr, index, 0);
DrawSpaceHistoryInterface(plr);
DrawMisHist(plr, *where);
};
Expand Down
8 changes: 7 additions & 1 deletion src/game/place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,13 @@ void writePrestigeFirst(char index) ///index==plr
}


void Draw_Mis_Stats(char plr, char index, int *where, char mode)
/**
*
* \param plr TODO
* \param index TODO
* \param mode 0 for replay, 1 for after-mission summary.
*/
void Draw_Mis_Stats(int plr, int index, int mode)
{
if (mode == 0) {
InBox(245, 5, 314, 17);
Expand Down
2 changes: 1 addition & 1 deletion src/game/place.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum MainMenuOption {
};

int Help(const char *FName);
void Draw_Mis_Stats(char plr, char index, int *where, char mode);
void Draw_Mis_Stats(int plr, int index, int mode);
void PatchMe(char plr, int x, int y, char prog, char poff);
void BigHardMe(char plr, int x, int y, char hw, char unit, char sh);
void AstFaces(char plr, int x, int y, char face);
Expand Down
40 changes: 24 additions & 16 deletions src/game/replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ void
Replay(char plr, int num, int dx, int dy, int width, int height,
std::string Type)
{
int keep_going;
int i, j, kk, mode, max;
int32_t offset;
std::vector <REPLAY> Rep;
int j;
std::vector<REPLAY> Rep;
std::vector<struct MissionSequenceKey> sSeq, fSeq;
char *fname;

Expand All @@ -61,6 +59,7 @@ Replay(char plr, int num, int dx, int dy, int width, int height,
mm_file vidfile;
float fps;

// TODO: Free up memory in string returned by locate_file.
fname = locate_file("seq.json", FT_DATA);
DESERIALIZE_JSON_FILE(&sSeq, fname);

Expand All @@ -71,7 +70,7 @@ Replay(char plr, int num, int dx, int dy, int width, int height,

DEBUG2("video sequence: %d segments", Rep.size());

for (kk = 0; kk < Rep.size(); kk++) {
for (int kk = 0; kk < Rep.size(); kk++) {
DEBUG3("playing segment %d: %s", kk, Rep.at(kk).seq.c_str());

if (Rep.at(kk).Failure) {
Expand All @@ -81,7 +80,7 @@ Replay(char plr, int num, int dx, int dy, int width, int height,
}
}

if (i == fSeq.size()) {
if (j == fSeq.size()) {
return;
}
} else {
Expand All @@ -96,23 +95,28 @@ Replay(char plr, int num, int dx, int dy, int width, int height,
}
}

i = 0;
max = Rep.at(kk).seq.at(1) - '0';

keep_going = 1;
int max = Rep.at(kk).seq.at(1) - '0';
bool keep_going = true;

// update_map = 0;
while (keep_going && i < max) {
int frm_idx;
for (int i = 0; i < max && keep_going; i++) {
char seq_name[20];
char fname[20];
char fname[20]; // TODO: Don't reuse name within function!

if (Rep.at(kk).Failure) {
strntcpy(seq_name, fSeq.at(j).video.at(i).c_str(), sizeof(seq_name));
} else {
strntcpy(seq_name, sSeq.at(j).video.at(i).c_str(), sizeof(seq_name));
}

// TODO: I added this because there are video sequences that
// do not have a numerical prefix (ex: training videos in
// ast3.cpp). They should be modified or this check
// maintained. -- rnyoakum
if (strncmp(seq_name, "NONE", MIN(4, sizeof(seq_name))) == 0) {
break;
}

/* here we should create YUV Overlay, but we can't use it on
* pallettized surface, so we use a global Overlay initialized in
* sdl.c. */
Expand All @@ -132,6 +136,7 @@ Replay(char plr, int num, int dx, int dy, int width, int height,
}

while (keep_going) {
int pressed = 0;
display::graphics.videoRect().x = dx;
display::graphics.videoRect().y = dy;
display::graphics.videoRect().w = width;
Expand All @@ -142,16 +147,19 @@ Replay(char plr, int num, int dx, int dy, int width, int height,
break;
}

if (bioskey(0) || grGetMouseButtons()) {
keep_going = 0;
if ((pressed = bioskey(0)) || grGetMouseButtons()) {
keep_going = false;

if (pressed == K_ESCAPE) {
kk = Rep.size();
}
}

/** \todo idle_loop is too inaccurate for this */
idle_loop_secs(1.0 / fps);
}

mm_close(&vidfile);
i++;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/review.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ void MisRev(char plr, int pres, int mis)
draw_small_flag(plr, 4, 4);

key = 0;
Draw_Mis_Stats(plr, mis, 0, 1);
Draw_Mis_Stats(plr, mis, 1);
key = 0;
display::graphics.screen()->clear();
return;
Expand Down