⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 starfighter.cpp

📁 打飞机的过关游戏(linux)
💻 CPP
字号:
/*
Project: Starfighter
Copyright Parallel Realities 2003
All Rights Reserved

Version: 1.0

Disclaimer
----------
Whilst every effort has been made to ensure that this code is free
from bugs and other such things that could cause damage or harm
to the machine it is run on (or even harm to individuals resulting
from damage to the machine), Parallel Realities will not be held
responsible for any such harm occuring. Installing or running this
software is done at the user's own risk. If you do not agree to
these terms, then you may not use this software. Please be aware
that by installing or executing this program code you are automatically
agreeing to this disclaimer.
*/

#include "version.h"
#include "Starfighter.h"
#include <unistd.h>

int main(int argc, char *argv[])
{
	defineGlobals(); // Must do this first!

	signed char cheatAttempt = 0;

	int counti;
	char datapath[256];

	for (counti=strlen(argv[0]) ; argv[0][counti]!='/' ; counti--);
	strncpy(datapath, argv[0], counti);
	chdir(datapath);

	if (argc > 1)
	{
		if (strcmp("--help", argv[1]) == 0)
		{
			printf("\nProject: Starfighter %s\n", VERSION);
			printf("Copyright Parallel Realities 2003\n\n");
			printf("Additional Commands\n");
			printf("\t-noaudio     Disables sound and music\n");
			printf("\t-mono        Mono sound output (best for headphones)\n\n");
			printf("www.parallelrealities.co.uk\n");
			printf("\n");
			exit(0);
		}
	}

	for (int i = 1 ; i < argc ; i++)
	{
		#if USEPACK
		#else
		if (strcmp(argv[i], "-nomove") == 0)
			{printf("Enemy movement disabled\n"); dev.moveAliens = 0;}
		if (strcmp(argv[i], "-nofire") == 0)
			{printf("Enemy firing disabled\n"); dev.fireAliens = 0;}
		#endif
		if (strcmp(argv[i], "-cheat") == 0)
			cheatAttempt = 1;
		if (strcmp(argv[i], "-noaudio") == 0)
			{printf("No Audio\n"); engine.useAudio = 0;}
		if (strcmp(argv[i], "-mono") == 0)
			{printf("Mono sound output\n"); engine.useAudio = 1;}
	}

	atexit(cleanUp);

	initSystem(); // Opens video mode and sound
	loadFont();

	if (cheatAttempt)
	{
		graphics.clearScreen(graphics.black);
		graphics.drawString("That doesn't work anymore", -1, 285, FONT_WHITE);
		graphics.drawString("Try harder...", -1, 315, FONT_WHITE);
		graphics.updateScreen();
		SDL_Delay(2000);
		graphics.clearScreen(graphics.black);
		graphics.updateScreen();
		SDL_Delay(500);
	}

	graphics.freeGraphics();
	loadSound();

	initWeapons();

	initVars();
	defineAliens();

	graphics.setColorIndexes();

	setAllyMessages();

	showStory();

	// Determine which part of the game we will go to...
	int section = 0;

	newGame();

	/*
	currentGame.system = 2;
	currentGame.area = 27;
	currentGame.shieldUnits = 4;
	currentGame.hasWingMate1 = 1;
	currentGame.hasWingMate2 = 1;

	player.shield = (currentGame.shieldUnits * 25);

	player.weaponType[1] = W_LASER;

	player.ammo[0] = 1;
	weapon[1].ammo[0] = 3;
	weapon[1].damage = 5;
	weapon[1].reload[0] = 7;

	engine.cheatAmmo = 1;
	engine.cheatShield = 1;
	engine.cheatCash = 1;
	//updateSystemStatus();
	*/

	while (true)
	{
		switch(section)
		{
			case 0:
				section = doTitle();
				break;

			case 1:
				section = galaxyMap();
				break;

			case 2:
				if (currentGame.stationedPlanet == -1) {doCutscene(0);}
				section = mainGameLoop();
				break;
		}
	}

	//doTitle();
	//galaxyMap();
	//mainGameLoop();
	//doCutscene(2);
	//doCredits();

	return(0);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -