Exemplo n.º 1
0
void SPAddVec2N (string &s, const string &tag, const TVector2 val, int count) {
	s += "[";
	s += tag;
	s += "]";
	s += ' ';
	s += Float_StrN (val.x, count);
	s += " ";
	s += Float_StrN (val.y, count);
}
Exemplo n.º 2
0
void DrawFps () {
	if (g_game.mode != RACING) return;
	string fpsstr;
	TColor col;

	if (numFrames >= maxFrames) {
		averagefps = 1 / sumTime * maxFrames;
		numFrames = 0;
		sumTime = 0;
	} else {
		sumTime += g_game.time_step;
		numFrames++;
	}
	if (averagefps < 1) return;

	if (param.display_fps) {
		if (averagefps >= 35) col = colWhite; else col = colRed;
		fpsstr = Float_StrN (averagefps, 0);
		if (param.use_papercut_font < 2) {
			Tex.DrawNumStr (fpsstr.c_str(), (param.x_resolution - 60) / 2, 10, 1, colWhite);
		} else {
			FT.SetColor (colDYell);
			FT.DrawString ((param.x_resolution - 60) / 2, 10, fpsstr);
		}
	}
}
Exemplo n.º 3
0
bool CScore::SaveHighScore () const {
	CSPList splist ((int)Scorelist.size()*MAX_SCORES);

	for (size_t li=0; li<Scorelist.size(); li++) {
		const TScoreList* lst = &Scorelist[li];
		if (lst != NULL) {
			int num = lst->numScores;
			if (num > 0) {
				for (int sc=0; sc<num; sc++) {
					const TScore& score = lst->scores[sc];
					string line = "*[course] " + Course.CourseList[li].dir;
					line += " [plyr] " + score.player;
					line += " [pts] " + Int_StrN (score.points);
					line += " [herr] " + Int_StrN (score.herrings);
					line += " [time] " + Float_StrN (score.time, 1);
					splist.Add (line);
				}
			}
		}
	}
	if (!splist.Save (param.config_dir, "highscore")) {
		Message ("could not save highscore list");
		return false;
	}
	return true;
}
Exemplo n.º 4
0
void PrintFrameParams (int ytop, TKeyframe2 *frame) {
	int y, x;
	int offs = 18;
	
	for (int i=0; i<=last_joint; i++) {
		if (i == curr_joint) FT.SetColor (colYellow); 
		else FT.SetColor (colLGrey); 

		x = ITrunc (i, jointbase) * 140 + 20;
		y = IFrac (i, jointbase) * offs + ytop;

		FT.DrawString (x, y, TestFrame.GetJointName(i));
		if (i < 4) FT.DrawString (x+80, y, Float_StrN (frame->val[i], 2));
		else FT.DrawString (x+80, y, Float_StrN (frame->val[i], 0));
	}
}
Exemplo n.º 5
0
void CCharShape::SaveCharNodes (string dir, string filename) {
	CSPList list (MAX_CHAR_NODES + 10);
	string line, order, joint;
	TCharNode *node;
	TCharAction *act;
	int  i, ii, aa;
	TVector3 rotation;
	bool rotflag;

	list.Add ("# Generated by Tuxracer tools");
	list.Add ("");
	if (numMatlines > 0) {
		list.Add ("# Materials:");
		for (i=0; i<numMatlines; i++) list.Add (Matlines[i]);
		list.Add ("");
	}

	list.Add ("# Nodes:");
	for (i=1; i<numNodes; i++) {
		node = Nodes[i];
		act = Actions[i];
		if (node->parent_name >= node->node_name) Message ("wrong parent index");
		line = "*[node] " + Int_StrN (node->node_name);
		line += " [par] " + Int_StrN (node->parent_name); 
		order = act->order;
		rotation = NullVec;
		rotflag = false;

		if (order.size() > 0) {
			line += " [order] " + order;
			for (ii=0; ii<(int)order.size(); ii++) {
				aa = order.at(ii)-48;	
				switch (aa) {
					case 0: line += " [trans] " + Vector_StrN (act->vec[ii], 2); break;
					case 4: line += " [scale] " + Vector_StrN (act->vec[ii], 2); break;
 					case 1: rotation.x = act->dval[ii]; rotflag = true; break;
 					case 2: rotation.y = act->dval[ii]; rotflag = true; break;
 					case 3: rotation.z = act->dval[ii]; rotflag = true; break;
					case 5: line += " [vis] " + Float_StrN (act->dval[ii], 0); break;
					case 9: rotation.z = act->dval[ii]; rotflag = true; break;
				}
			}
			if (rotflag) line += " [rot] " + Vector_StrN (rotation, 2);
		}
		if (act->mat.size() > 0) line += " [mat] " + act->mat;
		if (node->joint.size() > 0) line += " [joint] " + node->joint;
		if (act->name.size() > 0) line += " [name] " + act->name;
		if (node->render_shadow) line += " [shad] 1";
		
		list.Add (line);
		if (i<numNodes-3) {
			if (node->visible && !Nodes[i+1]->visible) list.Add ("");
			joint = Nodes[i+2]->joint;
			if (joint.size() > 0) list.Add ("# " + joint);
		}
	}	
	list.Save (dir, filename);
}
Exemplo n.º 6
0
void CScore::Loop () {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;

	Music.Update ();
	check_gl_error();
	ClearRenderContext ();
	ScopedRenderMode rm(GUI);
	SetupGuiDisplay ();

	if (param.ui_snow) {
		update_ui_snow ();
		draw_ui_snow();
	}

	Tex.Draw (BOTTOM_LEFT, 0, hh - 256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);
	//Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), Winsys.scale);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, colBlack, 0.2);

	FT.AutoSizeN (7);
	FT.SetColor (colWhite);
	FT.DrawString (CENTER, AutoYPosN (Winsys.resolution.width > Winsys.resolution.height ? 6 : 22), Trans.Text(62));

	DrawFrameX (area.left, frametop, framewidth - 93, frameheight, 3, colMBackgr, colWhite, 1.0);
	FT.AutoSizeN (4);
	FT.SetColor (colDYell);
	FT.DrawString (area.left+20, frametop, CourseList[course->GetValue()].name);

	const TScoreList *list = Score.GetScorelist (course->GetValue());

	FT.SetColor (colWhite);
	if (list != NULL) {
		FT.AutoSizeN (3);
		if (list->numScores < 1) {
			FT.DrawString (CENTER, area.top + 140, Trans.Text(63));
		} else {
			for (int i=0; i<min(MAX_SCORES, list->numScores); i++) {
				int y = listtop + i*linedist;
				FT.DrawString (area.left, y, ordinals[i]);
				FT.DrawString (area.left + dd1, y, Int_StrN (list->scores[i].points));
				FT.DrawString (area.left + dd2, y, list->scores[i].player);
				FT.DrawString (area.left + dd3, y,
				               Int_StrN (list->scores[i].herrings) + "  herrings");
				FT.DrawString (area.left + dd4, y,
				               Float_StrN (list->scores[i].time, 1) + "  sec");
			}
		}
	} else Message ("score list out of range");

	DrawGUI();

	Winsys.SwapBuffers();
}
Exemplo n.º 7
0
void SPSetFloatN (string &s, const string &tag, const float val, int count) {
	int pos = SPPosN (s, tag);
	if (pos >= 0) {
		int ipos = pos + tag.size() + 2;
		string item = SPItemN (s, tag);
		if (item.size() > 0) SDeleteN (s, ipos, item.size()); 
		SInsertN (s, ipos, Float_StrN (val, count));
	} else SPAddFloatN (s, tag, val, count);
}
Exemplo n.º 8
0
void CKeyframe::SaveTest(const std::string& dir, const std::string& filename) const {
	CSPList list;

	for (std::size_t i=0; i<frames.size(); i++) {
		const TKeyframe* frame = &frames[i];
		std::string line = "*[time] " + Float_StrN(frame->val[0], 1);
		line += " [pos] " + Float_StrN(frame->val[1], 2);
		line += " " + Float_StrN(frame->val[2], 2);
		line += " " + Float_StrN(frame->val[3], 2);
		if (frame->val[4] != 0) line += " [yaw] " + Int_StrN((int)frame->val[4]);
		if (frame->val[5] != 0) line += " [pitch] " + Int_StrN((int)frame->val[5]);
		if (frame->val[6] != 0) line += " [roll] " + Int_StrN((int)frame->val[6]);
		if (frame->val[7] != 0) line += " [neck] " + Int_StrN((int)frame->val[7]);
		if (frame->val[8] != 0) line += " [head] " + Int_StrN((int)frame->val[8]);

		double ll = frame->val[9];
		double rr = frame->val[10];
		if (ll != 0 || rr != 0)
			line += " [sh] " + Int_StrN((int)ll) + ' ' + Int_StrN((int)rr);

		ll = frame->val[11];
		rr = frame->val[12];
		if (ll != 0 || rr != 0)
			line += " [arm] " + Int_StrN((int)ll) + ' ' + Int_StrN((int)rr);

		ll = frame->val[13];
		rr = frame->val[14];
		if (ll != 0 || rr != 0)
			line += " [hip] " + Int_StrN((int)ll) + ' ' + Int_StrN((int)rr);

		ll = frame->val[15];
		rr = frame->val[16];
		if (ll != 0 || rr != 0)
			line += " [knee] " + Int_StrN((int)ll) + ' ' + Int_StrN((int)rr);

		ll = frame->val[17];
		rr = frame->val[18];
		if (ll != 0 || rr != 0)
			line += " [ankle] " + Int_StrN((int)ll) + ' ' + Int_StrN((int)rr);

		list.Add(line);
	}
	list.Save(dir, filename);
}
Exemplo n.º 9
0
void PrintGLInfo (){
#ifndef __PSP__
    char *extensions;
    char *p, *oldp;
    int i;
    GLint int_val;
    GLfloat float_val;
    GLboolean boolean_val;
	string ss;

    Message ("Gl vendor: ", (char*)glGetString (GL_VENDOR));
    Message ("Gl renderer: ", (char*)glGetString (GL_RENDERER));
    Message ("Gl version: ", (char*)glGetString (GL_VERSION));
    extensions = NewStr ((char*) glGetString (GL_EXTENSIONS));
    Message ("", "");
	Message ("Gl extensions:", "");
	Message ("", "");
	
    oldp = extensions;
    while ((p=strchr(oldp,' '))) {
		*p='\0';
		Message (oldp,"");
		oldp = p+1;
    }
    if (*oldp) Message (oldp,"");

    free (extensions);
	Message ("", "");
    for (i=0; i<(int)(sizeof(gl_values)/sizeof(gl_values[0])); i++) {
		switch (gl_values[i].type) {
			case GL_INT:
	    	glGetIntegerv (gl_values[i].value, &int_val);
		    ss = Int_StrN (int_val);
			Message (gl_values[i].name, ss.c_str());
		    break;

			case GL_FLOAT:
		    glGetFloatv (gl_values[i].value, &float_val);
    		ss = Float_StrN (float_val, 2);
			Message (gl_values[i].name, ss.c_str());
		    break;

			case GL_UNSIGNED_BYTE:
	    	glGetBooleanv (gl_values[i].value, &boolean_val);
		    ss = Int_StrN (boolean_val);
			Message (gl_values[i].name, ss.c_str());
		    break;

			default:
			Message ("","");
		}
    }
#endif
}
Exemplo n.º 10
0
void PrintGLInfo () {
    GLint int_val;
    GLfloat float_val;
    GLboolean boolean_val;
	string ss;

    Message ("Gl vendor: ", (char*)glGetString (GL_VENDOR));
    Message ("Gl renderer: ", (char*)glGetString (GL_RENDERER));
    Message ("Gl version: ", (char*)glGetString (GL_VERSION));
    string extensions = (char*)glGetString (GL_EXTENSIONS);
    Message ("", "");
	Message ("Gl extensions:", "");
	Message ("", "");

	size_t oldpos = 0;
	size_t pos;
    while ((pos = extensions.find(' ', oldpos)) != string::npos) {
		string s = extensions.substr(oldpos, pos-oldpos);
		Message(s, "");
		oldpos = pos+1;
    }
	Message(extensions.substr(oldpos), "");

	Message ("", "");
    for (int i=0; i<(int)(sizeof(gl_values)/sizeof(gl_values[0])); i++) {
		switch (gl_values[i].type) {
			case GL_INT:
	    	glGetIntegerv (gl_values[i].value, &int_val);
		    ss = Int_StrN (int_val);
			Message (gl_values[i].name, ss);
		    break;

			case GL_FLOAT:
		    glGetFloatv (gl_values[i].value, &float_val);
    		ss = Float_StrN (float_val, 2);
			Message (gl_values[i].name, ss);
		    break;

			case GL_UNSIGNED_BYTE:
	    	glGetBooleanv (gl_values[i].value, &boolean_val);
		    ss = Int_StrN (boolean_val);
			Message (gl_values[i].name, ss);
		    break;

			default:
			Message ("","");
		}
    }
}
Exemplo n.º 11
0
void CGameConfig::Loop () {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;

	Music.Update ();

	check_gl_error();
	Music.Update ();
	ScopedRenderMode rm(GUI);
	ClearRenderContext ();
	SetupGuiDisplay ();

	if (param.ui_snow) {
		update_ui_snow ();
		draw_ui_snow();
	}

	//Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), 1.0);
	Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, colBlack, 0.2);

	FT.AutoSizeN (4);

	FT.SetColor (colWhite);
	FT.DrawString (area.left, area.top, Trans.Text(86));
	FT.DrawString (area.left, area.top + dd, Trans.Text(94));
	FT.DrawString (area.left, area.top + dd * 2, Trans.Text(33));
	FT.DrawString (area.left, area.top + dd * 3, Trans.Text(34));
	FT.DrawString (area.left, area.top + dd * 4, Trans.Text(36));
	FT.DrawString (area.left, area.top + dd * 5, Trans.Text(35));

	FT.DrawString (area.left+240, area.top, Trans.Text(87 + vid_orient->GetValue()));
	FT.DrawString (area.left+240, area.top + dd, Float_StrN(sensit->GetValue() / 10.0f, 1));
	FT.DrawString (area.left+240, area.top + dd * 2, Int_StrN (mus_vol->GetValue()));
	FT.DrawString (area.left+240, area.top + dd * 3, Int_StrN (sound_vol->GetValue()));
	FT.DrawString (area.left+240, area.top + dd * 4, Int_StrN (detail_level->GetValue()));
	FT.DrawString (area.left+240, area.top + dd * 5, Trans.languages[language->GetValue()].language);

	DrawGUI();

	Reshape (ww, hh);
	Winsys.SwapBuffers ();
}
Exemplo n.º 12
0
// for testing:
void CScore::PrintScorelist (size_t list_idx) const {
	if (list_idx >= Scorelist.size()) return;
	const TScoreList *list = &Scorelist[list_idx];

	if (list->numScores < 1) {
		PrintStr ("no entries in this score list");
	} else {
		for (int i=0; i<list->numScores; i++) {
			string line = "player: " + list->scores[i].player;
			line += " points: " + Int_StrN (list->scores[i].points);
			line += " herrings: " + Int_StrN (list->scores[i].herrings);
			line += " time: " + Float_StrN (list->scores[i].time, 2);
			PrintString (line);
		}
	}
}
Exemplo n.º 13
0
void DrawActionVec (int nr, string s, int y, TVector3 v) {
	FT.SetColor (colLGrey);
	FT.DrawString (20, y, s);
	if (nr == curr_act) {
		if (comp == 0) {
			FT.SetColor (colYellow);
			FT.DrawString (100, y, Float_StrN (v.x, 2));
			FT.DrawString (150, y, Float_StrN (v.y, 2));
			FT.DrawString (200, y, Float_StrN (v.z, 2));
		} else {
			if (comp == 1) FT.SetColor (colYellow); else FT.SetColor (colLGrey);
			FT.DrawString (100, y, Float_StrN (v.x, 2));
			if (comp == 2) FT.SetColor (colYellow); else FT.SetColor (colLGrey);
			FT.DrawString (150, y, Float_StrN (v.y, 2));
			if (comp == 3) FT.SetColor (colYellow); else FT.SetColor (colLGrey);
			FT.DrawString (200, y, Float_StrN (v.z, 2));
		}
	} else {
		FT.DrawString (100, y, Float_StrN (v.x, 2));
		FT.DrawString (150, y, Float_StrN (v.y, 2));
		FT.DrawString (200, y, Float_StrN (v.z, 2));
	}
}
Exemplo n.º 14
0
void CEvent::Loop (double timestep) {
	int ww = Winsys.resolution.width;
	int hh = Winsys.resolution.height;

	check_gl_error();
	ScopedRenderMode rm(GUI);
	Music.Update ();
    ClearRenderContext ();
	SetupGuiDisplay ();

	if (param.ui_snow) {
		update_ui_snow (timestep);
		draw_ui_snow ();
	}
	Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), Winsys.scale);
	Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
	Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
	Tex.Draw (TOP_LEFT, 0, 0, 1);
	Tex.Draw (TOP_RIGHT, ww-256, 0, 1);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, colBlack, 0.2);

	if (ready == 0) {			// cup not finished
		FT.AutoSizeN (6);
		FT.SetColor (colWhite);
		FT.DrawString (CENTER, AutoYPosN (25), ecup->name);

		DrawBonusExt (bonustop, (int)ecup->races.size(), curr_bonus);

		DrawFrameX (area.left, frametop, framewidth,
			(int)ecup->races.size() * dist + 20, 3, colBackgr, colWhite, 1);

		for (size_t i=0; i<ecup->races.size(); i++) {
			FT.AutoSizeN (3);

			int y = frametop + 10 + (int)i * dist;
			if (i == curr_race)
				FT.SetColor (colDYell);
			else
				FT.SetColor (colWhite);
			FT.DrawString (area.left + 29, y, Course.CourseList[ecup->races[i]->course].name);
			Tex.Draw (CHECKBOX, area.right -54, y, texsize, texsize);
			if (curr_race > i) Tex.Draw (CHECKMARK, area.right-50, y + 4, 0.8);
		}

		FT.AutoSizeN (3);
		int ddd = FT.AutoDistanceN (1);
		FT.SetColor (colDBlue);
		string info = Trans.Text(11);
		info += "   " + Int_StrN (ecup->races[curr_race]->herrings.i);
		info += "   " + Int_StrN (ecup->races[curr_race]->herrings.j);
		info += "   " + Int_StrN (ecup->races[curr_race]->herrings.k);
		FT.DrawString (CENTER, framebottom+15, info);

		info = Trans.Text(12);
		info += "   " + Float_StrN (ecup->races[curr_race]->time.x, 0);
		info += "   " + Float_StrN (ecup->races[curr_race]->time.y, 0);
		info += "   " + Float_StrN (ecup->races[curr_race]->time.z, 0);
		info += "  " + Trans.Text(14);
		FT.DrawString (CENTER, framebottom+15+ddd, info);

	} else if (ready == 1) {		// cup successfully finished
		FT.AutoSizeN (5);
		FT.SetColor (colWhite);
		FT.DrawString (CENTER, messtop, Trans.Text(16));
		DrawBonusExt (bonustop, (int)ecup->races.size(), curr_bonus);
		int res = resultlevel(curr_bonus, ecup->races.size());
		FT.DrawString (CENTER, messtop2, Trans.Text(17) + "  "+Int_StrN (res));
	} else if (ready == 2) {		// cup finished but failed
		FT.AutoSizeN (5);
		FT.SetColor (colLRed);
		FT.DrawString (CENTER, messtop, Trans.Text(18));
		DrawBonusExt (bonustop, ecup->races.size(), curr_bonus);
		FT.DrawString (CENTER, messtop2, Trans.Text(19));
	}

	textbuttons[0]->SetVisible(ready < 1);
	textbuttons[1]->SetVisible(ready < 1);
	textbuttons[2]->SetVisible(!(ready < 1));

	DrawGUI ();
    Winsys.SwapBuffers();
}
Exemplo n.º 15
0
void DrawActionFloat (int nr, string s, int y, float f) {
	FT.SetColor (colLGrey);
	FT.DrawString (20, y, s);
	if (nr == curr_act) FT.SetColor (colYellow); else FT.SetColor (colLGrey);
	FT.DrawString (100, y, Float_StrN (f, 2));
}
Exemplo n.º 16
0
void CCharShape::SaveCharNodes (const string& dir, const string& filename) {
	CSPList list (MAX_CHAR_NODES + 10);

	list.Add ("# Generated by Tuxracer tools");
	list.AddLine ();
	if (!Materials.empty()) {
		list.Add ("# Materials:");
		for (size_t i=0; i<Materials.size(); i++)
			if (!Materials[i].matline.empty())
				list.Add (Materials[i].matline);
		list.AddLine ();
	}

	list.Add ("# Nodes:");
	for (size_t i=1; i<numNodes; i++) {
		TCharNode* node = Nodes[i];
		TCharAction* act = node->action;
		if (node->parent_name >= node->node_name) Message ("wrong parent index");
		string line = "*[node] " + Int_StrN ((int)node->node_name);
		line += " [par] " + Int_StrN ((int)node->parent_name);

		if (!act->order.empty()) {
			bool rotflag = false;
			TVector3d rotation;
			line += " [order] " + act->order;
			for (size_t ii=0; ii<act->order.size(); ii++) {
				int aa = act->order[ii]-48;
				switch (aa) {
					case 0:
						line += " [trans] " + Vector_StrN (act->vec[ii], 2);
						break;
					case 4:
						line += " [scale] " + Vector_StrN (act->vec[ii], 2);
						break;
					case 1:
						rotation.x = act->dval[ii];
						rotflag = true;
						break;
					case 2:
						rotation.y = act->dval[ii];
						rotflag = true;
						break;
					case 3:
						rotation.z = act->dval[ii];
						rotflag = true;
						break;
					case 5:
						line += " [vis] " + Float_StrN (act->dval[ii], 0);
						break;
					case 9:
						rotation.z = act->dval[ii];
						rotflag = true;
						break;
				}
			}
			if (rotflag) line += " [rot] " + Vector_StrN (rotation, 2);
		}
		if (!act->mat.empty()) line += " [mat] " + act->mat;
		if (!node->joint.empty()) line += " [joint] " + node->joint;
		if (!act->name.empty()) line += " [name] " + act->name;
		if (node->render_shadow) line += " [shad] 1";

		list.Add (line);
		if (i<numNodes-3) {
			if (node->visible && !Nodes[i+1]->visible) list.AddLine ();
			const string& joint = Nodes[i+2]->joint;
			if (joint.empty()) list.Add ("# " + joint);
		}
	}
	list.Save (dir, filename);
}
Exemplo n.º 17
0
string Vector_StrN (const TVector3 v, const int count) {
	string res = Float_StrN (v.x, count);
	res += " " + Float_StrN (v.y, count);
	res += " " + Float_StrN (v.z, count);
	return res;
}
Exemplo n.º 18
0
void CKeyframe::SaveTest (string dir, string filename) {
	CSPList list (100);
	string line;
	TKeyframe2 *frame;
	double ll, rr;

	for (int i=0; i<numFrames; i++) {
		frame = frames[i];
		line = "*[time] " + Float_StrN (frame->val[0], 1);
		line += " [pos] " + Float_StrN (frame->val[1], 2);
		line += " " + Float_StrN (frame->val[2], 2);
		line += " " + Float_StrN (frame->val[3], 2);
		if (frame->val[4] != 0) line += " [yaw] " + Float_StrN (frame->val[4], 0);
		if (frame->val[5] != 0) line += " [pitch] " + Float_StrN (frame->val[5], 0);
		if (frame->val[6] != 0) line += " [roll] " + Float_StrN (frame->val[6], 0);
		if (frame->val[7] != 0) line += " [neck] " + Float_StrN (frame->val[7], 0);
		if (frame->val[8] != 0) line += " [head] " + Float_StrN (frame->val[8], 0);

		ll = frame->val[9];
		rr = frame->val[10];
		if (ll != 0 || rr != 0) 
			line += " [sh] " + Float_StrN (ll, 0) + " " + Float_StrN (rr, 0);

		ll = frame->val[11];
		rr = frame->val[12];
		if (ll != 0 || rr != 0) 
			line += " [arm] " + Float_StrN (ll, 0) + " " + Float_StrN (rr, 0);

		ll = frame->val[13];
		rr = frame->val[14];
		if (ll != 0 || rr != 0) 
			line += " [hip] " + Float_StrN (ll, 0) + " " + Float_StrN (rr, 0);

		ll = frame->val[15];
		rr = frame->val[16];
		if (ll != 0 || rr != 0) 
			line += " [knee] " + Float_StrN (ll, 0) + " " + Float_StrN (rr, 0);

		ll = frame->val[17];
		rr = frame->val[18];
		if (ll != 0 || rr != 0) 
			line += " [ankle] " + Float_StrN (ll, 0) + " " + Float_StrN (rr, 0);

		list.Add (line);
	}
	list.Save (dir, filename);
}
Exemplo n.º 19
0
void SPAddFloatN (string &s, const string &tag, const float val, int count) {
	s += "[";
	s += tag;
	s += "]";
	s += Float_StrN (val, count);
}
Exemplo n.º 20
0
void GameOverMessage (CControl *ctrl) {
    int fwidth = 500;

    string line;
    float leftframe = (param.x_resolution - fwidth) / 2;
    float topframe = 80;

    TColor backcol = MakeColor (1, 1, 1, 1);
    TColor framecol = MakeColor (0.7, 0.7, 1, 1);

    if (param.use_papercut_font > 0) FT.SetSize (28);
    else FT.SetSize (22);
    if (g_game.raceaborted) {
        DrawMessageFrame (leftframe, topframe, fwidth, 100, 4, backcol, framecol, 0.5);
        FT.SetColor (colDBlue);
        FT.DrawString (CENTER, topframe+30, Trans.Text(25));
    } else {
        DrawMessageFrame (leftframe, topframe, fwidth, 210, 4, backcol, framecol, 0.5);

        if (param.use_papercut_font > 0) FT.SetSize (20);
        else FT.SetSize (14);
        if (g_game.race_result >= 0 || g_game.game_type != CUPRACING) FT.SetColor (colDBlue);
        else FT.SetColor (colDRed);

        line = "Score:  ";
        FT.DrawString (leftframe+80, topframe+15, line);
        line = Int_StrN (g_game.score);
        line += "  pts";
        FT.DrawString (leftframe+240, topframe+15, line);

        line = "Herring:  ";
        FT.DrawString (leftframe+80, topframe+40, line);
        line = Int_StrN (g_game.herring);
        if (g_game.game_type == CUPRACING) {
            line += "  (";
            line += Int_StrN (g_game.herring_req.i);
            line += ")";
        }
        FT.DrawString (leftframe+240, topframe+40, line);

        line = "Time:  ";
        FT.DrawString (leftframe+80, topframe+65, line);
        line = Float_StrN (g_game.time, 2);
        line += "  s";
        if (g_game.game_type == CUPRACING) {
            line += "  (";
            line += Float_StrN (g_game.time_req.x, 2);
            line += ")";
        }
        FT.DrawString (leftframe+240, topframe+65, line);

        line = "Path length:  ";
        FT.DrawString (leftframe+80, topframe+90, line);
        line = Float_StrN (ctrl->way, 2);
        line += "  m";
        FT.DrawString (leftframe+240, topframe+90, line);

        line = "Average speed:  ";
        FT.DrawString (leftframe+80, topframe+115, line);
        line = Float_StrN (ctrl->way / g_game.time * 3.6, 2);
        line += "  km/h";
        FT.DrawString (leftframe+240, topframe+115, line);

        if (param.use_papercut_font > 0) FT.SetSize (28);
        else FT.SetSize (22);
        if (g_game.game_type == CUPRACING) {
            switch (g_game.race_result) {
            case -1:
                FT.DrawString (CENTER, topframe+150, Trans.Text(21));
                break;
            case 0:
                FT.DrawString (CENTER, topframe+150, Trans.Text(22));
                break;
            case 1:
                FT.DrawString (CENTER, topframe+150, Trans.Text(23));
                break;
            case 2:
                FT.DrawString (CENTER, topframe+150,  Trans.Text(24));
                break;
            }
        } else {
            if (highscore_pos < 5) {
                line = "Position ";
                line += Int_StrN (highscore_pos + 1);
                line += " in highscore list";
                FT.DrawString (CENTER, topframe+150, line);
            }
        }
    }
}
Exemplo n.º 21
0
void EventLoop (double timestep) {
    int ww = param.x_resolution;
    int hh = param.y_resolution;
    int i;
    TColor col;
    int y;
    string info;

    check_gl_error();
    set_gl_options (GUI );
    Music.Update ();
    ClearRenderContext ();
    SetupGuiDisplay ();

    if (param.ui_snow) {
        update_ui_snow (timestep);
        draw_ui_snow ();
    }
    Tex.Draw (T_TITLE_SMALL, CENTER, AutoYPosN (5), param.scale);
    Tex.Draw (BOTTOM_LEFT, 0, hh-256, 1);
    Tex.Draw (BOTTOM_RIGHT, ww-256, hh-256, 1);
    Tex.Draw (TOP_LEFT, 0, 0, 1);
    Tex.Draw (TOP_RIGHT, ww-256, 0, 1);

//	DrawFrameX (area.left, area.top, area.right-area.left, area.bottom - area.top,
//			0, colMBackgr, colBlack, 0.2);

    if (ready == 0) {			// cup not finished
        FT.AutoSizeN (6);
        FT.SetColor (colWhite);
        FT.DrawString (CENTER, AutoYPosN (25), ecup->name);

        DrawBonusExt (bonustop, ecup->num_races, curr_bonus);

        DrawFrameX (area.left, frametop, framewidth,
                    ecup->num_races * dist + 20, 3, colBackgr, colWhite, 1);

        for (i=0; i<ecup->num_races; i++) {
            if (i == curr_race) col = colDYell;
            else col = colWhite;
            FT.AutoSizeN (3);

            y = frametop + 10 + i * dist;
            FT.SetColor (col);
            FT.DrawString (area.left + 29, y, Course.CourseList[ecourseidx[i]].name);
            Tex.Draw (CHECKBOX, area.right -54, y, texsize, texsize);
            if (curr_race > i) Tex.Draw (CHECKMARK, area.right-50, y + 4, 0.8);
        }

        FT.AutoSizeN (3);
        int ddd = FT.AutoDistanceN (1);
        FT.SetColor (colDBlue);
        info = Trans.Text(11);
        info += "   " + Int_StrN (eraces[curr_race]->herrings.i);
        info += "   " + Int_StrN (eraces[curr_race]->herrings.j);
        info += "   " + Int_StrN (eraces[curr_race]->herrings.k);
        FT.DrawString (CENTER, framebottom+15, info);

        info = Trans.Text(12);
        info += "   " + Float_StrN (eraces[curr_race]->time.x, 0);
        info += "   " + Float_StrN (eraces[curr_race]->time.y, 0);
        info += "   " + Float_StrN (eraces[curr_race]->time.z, 0);
        info += "  " + Trans.Text(14);
        FT.DrawString (CENTER, framebottom+15+ddd, info);

    } else if (ready == 1) {		// cup successfully finished
        FT.AutoSizeN (5);
        FT.SetColor (colWhite);
        FT.DrawString (CENTER, messtop, Trans.Text(16));
        DrawBonusExt (bonustop, ecup->num_races, curr_bonus);
        int res = resultlevel(curr_bonus, ecup->num_races);
        FT.DrawString (CENTER, messtop2, Trans.Text(17) + "  "+Int_StrN (res));
    } else if (ready == 2) {		// cup finished but failed
        FT.AutoSizeN (5);
        FT.SetColor (colLRed);
        FT.DrawString (CENTER, messtop, Trans.Text(18));
        DrawBonusExt (bonustop, ecup->num_races, curr_bonus);
        FT.DrawString (CENTER, messtop2, Trans.Text(19));
    }
    if (ready < 1) {
        PrintTextButton (0, curr_focus);
        PrintTextButton (1, curr_focus);
    } else PrintTextButton (2, curr_focus);

    if (param.ice_cursor) DrawCursor ();
    SDL_GL_SwapBuffers ();
}