Skip to content

Commit

Permalink
2007-01-03 Pace Willisson <[email protected]>
Browse files Browse the repository at this point in the history
	* V44

	* support blocking for X events or time going by, instead of
	always running at about 30 frames per second; try to recognize
	when we are falling behind on the newscaster animation and skip
	frames to catch up; remove some dead code; add dbg() function
	from libopus which prints nice timestamps on log messages; improve
	animation handling in port.c so it doesn't waste so much cpu time;

2007-01-03  Michael McCarty <[email protected]>
  • Loading branch information
pace committed Jan 4, 2007
1 parent 9ba9924 commit 3375cd2
Show file tree
Hide file tree
Showing 14 changed files with 612 additions and 141 deletions.
339 changes: 339 additions & 0 deletions COPYING

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2007-01-03 Pace Willisson <[email protected]>

* V44

* support blocking for X events or time going by, instead of
always running at about 30 frames per second; try to recognize
when we are falling behind on the newscaster animation and skip
frames to catch up; remove some dead code; add dbg() function
from libopus which prints nice timestamps on log messages; improve
animation handling in port.c so it doesn't waste so much cpu time;

2007-01-03 Michael McCarty <[email protected]>

* V43
Expand All @@ -15,7 +26,8 @@
* V41

* Encapsulated the creation of ENDGAME.TMP into a single function.
* Turned off save game encryption. Move it into an #ifdef for historical purposes.
* Turned off save game encryption. Move it into an #ifdef for
historical purposes.

2007-01-03 Michael McCarty <[email protected]>

Expand Down
10 changes: 10 additions & 0 deletions QUESTIONS
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Shall we rip out the calls to MouseOn and MouseOff? The window system
does all this work now, so these functions are no-ops. It might be
tempting to think that leaving them in could be useful if we wanted to
run on bare hardware again, but since they aren't in use now, it would
be pretty likely that bugs would be introduced before the unlikely
time that they would be needed. I think the simplification would
be worthwhile.



The frame rate in the FRM files seems to be 8, which means 8 frames
per second, right?
- I think this is right.
Expand Down
24 changes: 24 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
rename UpdatePort

when updating the x server, scan top and bottom of the previous
and current image for identical parts, then send just the middle
part that has changed

wastes cpu time when showing the new image

drop frames if getting behind on newscaster or movie playback

look into "hold frame" stuff for aligning mission video and audio


remove SetROMDir

fades
Expand All @@ -7,11 +20,22 @@ implement PlayAudio ... summing sound effects with music

clean up extra gr_sync's

================================================================
enhancements:

water seems to flow backwards in DoCycle
optimize grPutPixel and grGetPixel

I started the game and it happend that a plane flew by on the first view
of the space port. I never typed anything, but later I noticed that there
was a plane stuck to the left edge of the screen. It disappeared after I
switched to another screen (R&D), then back to the port.

=> the probem is that the gx routines should clip - we're seeing the
wrapped image

try mpeg encoding the video

================================================================
possible old bugs

Expand Down
1 change: 1 addition & 0 deletions av.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
void av_step (void);
void av_block (void);
void av_setup (int *argcp, char ***argvp);
void av_silence (void);
void av_sync (void);
Expand Down
4 changes: 0 additions & 4 deletions gx.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ gxVirtualVirtual (GXHEADER *from,
int row, col;
int from_idx, to_idx;

gr_sync ();

w = from_x2 - from_x1 + 1;
h = from_y2 - from_y1 + 1;

Expand All @@ -195,8 +193,6 @@ gxVirtualVirtual (GXHEADER *from,
to->vptr[to_idx] = from->vptr[from_idx];
}
}

gr_sync ();
}

void
Expand Down
42 changes: 11 additions & 31 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

//ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
//ºInterplay's BUZZ ALDRIN's RACE into SPACE º
//º º
//ºFormerly -=> LiftOff : Race to the Moon :: IBM version MCGA º
//ºCopyright 1991 by Strategic Visions, Inc. º
//ºDesigned by Fritz Bronner º
//ºProgrammed by Michael K McCarty º
//º º
//ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
//****************************************************************
//*Interplay's BUZZ ALDRIN's RACE into SPACE *
//* *
//*Formerly -=> LiftOff : Race to the Moon :: IBM version MCGA *
//*Copyright 1991 by Strategic Visions, Inc. *
//*Designed by Fritz Bronner *
//*Programmed by Michael K McCarty *
//* *
//****************************************************************

#include "Buzz_inc.h"
int cdROM,hDISK;
Expand Down Expand Up @@ -104,24 +104,6 @@ void Plop(char plr,char mode);

int TimingThing(void);

/////////////////////////////////////////////
// Set the Directory to the current ROM Directory
//
int cDrive;

void SetROMDir(void)
{
}

////////////////////////////////////////////
// Restore the Directory to the original directory
// on the hard disk
//
void RestoreDir(void)
{

}

void mikeCrearScreen(void)
{
MouseOff();
Expand Down Expand Up @@ -855,7 +837,7 @@ void DV(GXHEADER *obj)
void
GetMouse (void)
{
idle_loop_secs (.030);
av_block ();
GetMouse_fast ();
}

Expand All @@ -868,6 +850,7 @@ void GetMouse_fast(void)
oldx=x;oldy=y;

gr_maybe_sync ();
av_step ();

if (XMAS!=0) {
if (grGetMouseButtons()) {
Expand Down Expand Up @@ -913,8 +896,6 @@ void MouseOn(void)

void PauseMouse(void)
{
gr_sync ();

/* wait until mouse button is released */
while(1) {
GetMouse(); /* blocks briefly */
Expand Down Expand Up @@ -1387,7 +1368,6 @@ void Plop(char plr,char mode)
if (BIG==0) SMove(&vhptr.vptr[40000],80,3+plr*10);
else LMove(&vhptr.vptr[40000]);
fclose(fin);
gr_sync ();
return;
}

Expand Down
62 changes: 33 additions & 29 deletions news.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
#include "externs.h"
#include "replay.h"

double load_news_anim_start;


char *totnews_dat;
int totnews_offset;

Expand All @@ -37,7 +40,8 @@ int totnews_offset;

int bufsize;
int evflag,LOAD_US=0,LOAD_SV=0;
BYTE Frame,X_Offset,Y_Offset,Depth,Length,MaxFrame,AnimIndex;
int Frame;
BYTE X_Offset,Y_Offset,Depth,Length,MaxFrame,AnimIndex;
WORD handle0,handle1,handle2,handle3,handle4,handle5;
extern char Option;
extern char Musics,Sounds;
Expand Down Expand Up @@ -488,10 +492,10 @@ void News(char plr)
RectFill(227,108,228,108,grGetPixel(227,108));
MouseOn();
}
PlayNewsAnim(AnimIndex);
PlayNewsAnim(AnimIndex);
PlayNewsAnim(AnimIndex);
PlayNewsAnim(AnimIndex);
PlayNewsAnim();
PlayNewsAnim();
PlayNewsAnim();
PlayNewsAnim();
NGetVoice(plr,0);
PlayVoice();
loc++;
Expand All @@ -508,11 +512,11 @@ void News(char plr)
else if (plr==0) LoadNewsAnim((BW==0) ? 3 : 2,FIRST_FRAME);
Status=0;
if (plr==0) {
PlayNewsAnim(AnimIndex);
PlayNewsAnim(AnimIndex);
PlayNewsAnim(AnimIndex);
PlayNewsAnim(AnimIndex);
PlayNewsAnim(AnimIndex);
PlayNewsAnim();
PlayNewsAnim();
PlayNewsAnim();
PlayNewsAnim();
PlayNewsAnim();
}
NGetVoice(plr,1);
PlayVoice();
Expand Down Expand Up @@ -554,9 +558,9 @@ void News(char plr)

if (Frame!=MaxFrame)
{
PlayNewsAnim(AnimIndex);
PlayNewsAnim();
if (Frame==MaxFrame) Status=1;
};
} else { idle_loop_secs (.125); }

//: Repeat News Sequence
if (key=='R' && loc==6)
Expand Down Expand Up @@ -602,7 +606,7 @@ void News(char plr)
DrawNText(plr,ctop);
MouseOff();OutBox(303,158,313,194);MouseOn();
}
gr_sync ();
// gr_sync ();
};
}

Expand Down Expand Up @@ -665,10 +669,19 @@ void Breakgrp(char plr)
}; /* for k */
}

void PlayNewsAnim(BYTE Index)
void PlayNewsAnim(void)
{
GXHEADER local;

double delta;
int frames_realtime;
int skip_frame;

skip_frame = 0;
delta = get_time () - load_news_anim_start;
frames_realtime = delta * 15;
if (Frame < frames_realtime)
skip_frame = 1;

GV(&local,Depth,Length);

RLED_img (totnews_dat + totnews_offset + table[Frame].offset,
Expand All @@ -681,24 +694,12 @@ void PlayNewsAnim(BYTE Index)
DV(&local);
Frame+=1;

gr_sync ();
idle_loop_secs (1 / 30.0);
if (skip_frame == 0)
idle_loop_secs (1 / 16.0);

return;
}

void FillAnim(unsigned index,unsigned maxf)
{
unsigned fill;

MouseOff();
fill=((float)index/(float)maxf)*203;
if (index==maxf) fill=203;
if (fill>0 && fill<=203)
RectFill(54,109,54+(unsigned int)fill,118,7);
MouseOn();
return;
}

void LoadNewsAnim(BYTE Index,BYTE Mode)
{
Expand All @@ -721,6 +722,8 @@ void LoadNewsAnim(BYTE Index,BYTE Mode)
long offset;
} god[12];

load_news_anim_start = get_time ();

if (Mode==1) {
switch(Index)
{
Expand Down Expand Up @@ -798,6 +801,7 @@ void LoadNewsAnim(BYTE Index,BYTE Mode)
MouseOn();
gxDestroyVirtual(&vhptr2);
DV(&local);

};

if (Mode == 69) { // *************** TCS001 my kludge (tom) 3/15/94
Expand Down
69 changes: 69 additions & 0 deletions pace.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,3 +798,72 @@ xstrdup (char const *s)

return (p);
}

#define debug_file stdout
void
vdbg (char const *fmt, va_list args)
{
char buf[10000];
char *p;
struct tm tm;
struct timeval tv;
time_t t;
int binchars;
static unsigned long last_millitime;
unsigned long this_millitime;
int delta;

gettimeofday (&tv, NULL);
t = tv.tv_sec;
tm = *localtime (&t);

p = buf;

sprintf (p, "%02d:%02d:%02d.%03d ", tm.tm_hour, tm.tm_min, tm.tm_sec,
(int)(tv.tv_usec / 1000));
p += strlen (p);

this_millitime = (tm.tm_hour * 3600 + tm.tm_min * 60 + tm.tm_sec)
* 1000 + tv.tv_usec / 1000;

if (last_millitime == 0)
last_millitime = this_millitime;

delta = this_millitime - last_millitime;
last_millitime = this_millitime;

if (delta < 0)
delta = 0;

sprintf (p, "%5d ", delta);
p += strlen (p);

vsprintf (p, fmt, args);

p += strlen (p);
while (p != buf && (p[-1] == '\n' || p[-1] == '\r'))
*--p = 0;

binchars = 0;
for (p = buf; *p && binchars < 20; p++) {
int c = *p;
if ((c >= ' ' && c < 0177) || c == '\t' || c == '\n') {
putc (c, debug_file);
} else {
binchars++;
putc ('.', debug_file);
}
}
putc ('\n', debug_file);
fflush (debug_file);
}

void
dbg (char const *fmt, ...)
{
va_list args;

va_start (args, fmt);
vdbg (fmt, args);
va_end (args);
}
Loading

0 comments on commit 3375cd2

Please sign in to comment.