[Add] planet_getClass. Lots more music.
This commit is contained in:
parent
0b9f89e4a9
commit
e3ddc663bf
@ -14,15 +14,34 @@ function choose(str)
|
|||||||
music.play()
|
music.play()
|
||||||
|
|
||||||
elseif str == "land" then
|
elseif str == "land" then
|
||||||
music.load("agriculture")
|
planet = space.landName()
|
||||||
|
class = space.planetClass(planet)
|
||||||
|
|
||||||
|
if class == "M" then
|
||||||
|
mus = "agriculture"
|
||||||
|
elseif class == "" then
|
||||||
|
mus = "ocean"
|
||||||
|
elseif class == "" then
|
||||||
|
mus = "snow"
|
||||||
|
else
|
||||||
|
if space.planetServices(planet) > 0 then
|
||||||
|
mus = "cosmostation"
|
||||||
|
else
|
||||||
|
mus = "agriculture"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
music.load(mus)
|
||||||
music.play()
|
music.play()
|
||||||
|
|
||||||
elseif str == "takeoff" then
|
elseif str == "takeoff" then
|
||||||
music.load("liftoff")
|
takeoff = { "liftoff", "launch2", "launch3chatstart" }
|
||||||
|
music.load(takeoff[rnd.int(1, #takeoff)])
|
||||||
music.play()
|
music.play()
|
||||||
|
|
||||||
elseif str == "ambient" then
|
elseif str == "ambient" then
|
||||||
music.load("machina")
|
ambient = { "peace1", "mission", "peace2", "peace4", "peace6" }
|
||||||
|
music.load(ambient[rnd.int(1, #ambient)])
|
||||||
music.play()
|
music.play()
|
||||||
|
|
||||||
elseif str == "combat" then
|
elseif str == "combat" then
|
||||||
|
BIN
snd/music/cosmostation.ogg
Normal file
BIN
snd/music/cosmostation.ogg
Normal file
Binary file not shown.
BIN
snd/music/launch2.ogg
Normal file
BIN
snd/music/launch2.ogg
Normal file
Binary file not shown.
BIN
snd/music/launch3chatstart.ogg
Normal file
BIN
snd/music/launch3chatstart.ogg
Normal file
Binary file not shown.
BIN
snd/music/mission.ogg
Normal file
BIN
snd/music/mission.ogg
Normal file
Binary file not shown.
BIN
snd/music/ocean.ogg
Normal file
BIN
snd/music/ocean.ogg
Normal file
Binary file not shown.
BIN
snd/music/peace1.ogg
Normal file
BIN
snd/music/peace1.ogg
Normal file
Binary file not shown.
BIN
snd/music/peace2.ogg
Normal file
BIN
snd/music/peace2.ogg
Normal file
Binary file not shown.
BIN
snd/music/peace4.ogg
Normal file
BIN
snd/music/peace4.ogg
Normal file
Binary file not shown.
BIN
snd/music/peace6.ogg
Normal file
BIN
snd/music/peace6.ogg
Normal file
Binary file not shown.
BIN
snd/music/snow.ogg
Normal file
BIN
snd/music/snow.ogg
Normal file
Binary file not shown.
@ -1025,9 +1025,6 @@ void land(Planet* p) {
|
|||||||
|
|
||||||
if(landed) return;
|
if(landed) return;
|
||||||
|
|
||||||
/* Change music. */
|
|
||||||
music_choose("land");
|
|
||||||
|
|
||||||
/* Load stuff. */
|
/* Load stuff. */
|
||||||
land_planet = p;
|
land_planet = p;
|
||||||
gfx_exterior = gl_newImage(p->gfx_exterior);
|
gfx_exterior = gl_newImage(p->gfx_exterior);
|
||||||
@ -1079,6 +1076,11 @@ void land(Planet* p) {
|
|||||||
|
|
||||||
|
|
||||||
landed = 1;
|
landed = 1;
|
||||||
|
|
||||||
|
/* Change the music. */
|
||||||
|
music_choose("land");
|
||||||
|
|
||||||
|
/* Run hooks. */
|
||||||
hooks_run("land");
|
hooks_run("land");
|
||||||
|
|
||||||
/* Generate mission computer stuff. */
|
/* Generate mission computer stuff. */
|
||||||
|
42
src/llua.c
42
src/llua.c
@ -30,6 +30,8 @@ static int space_landName(lua_State* L);
|
|||||||
static int space_systemName(lua_State* L);
|
static int space_systemName(lua_State* L);
|
||||||
static int space_jumpDist(lua_State* L);
|
static int space_jumpDist(lua_State* L);
|
||||||
static int space_faction(lua_State* L);
|
static int space_faction(lua_State* L);
|
||||||
|
static int space_planetClass(lua_State* L);
|
||||||
|
static int space_planetServices(lua_State* L);
|
||||||
static const luaL_reg space_methods[] = {
|
static const luaL_reg space_methods[] = {
|
||||||
{ "getPlanet", space_getPlanet },
|
{ "getPlanet", space_getPlanet },
|
||||||
{ "getSystem", space_getSystem },
|
{ "getSystem", space_getSystem },
|
||||||
@ -37,6 +39,8 @@ static const luaL_reg space_methods[] = {
|
|||||||
{ "system", space_systemName },
|
{ "system", space_systemName },
|
||||||
{ "jumpDist", space_jumpDist },
|
{ "jumpDist", space_jumpDist },
|
||||||
{ "spaceFaction", space_faction },
|
{ "spaceFaction", space_faction },
|
||||||
|
{ "planetClass", space_planetClass },
|
||||||
|
{ "planetServices", space_planetServices },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -315,6 +319,44 @@ static int space_faction(lua_State* L) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int space_planetClass(lua_State* L) {
|
||||||
|
Planet* p;
|
||||||
|
char buf[2];
|
||||||
|
|
||||||
|
LLUA_MIN_ARGS(1);
|
||||||
|
|
||||||
|
/* Get planet. */
|
||||||
|
if(lua_isstring(L, 1))
|
||||||
|
p = planet_get((char*)lua_tostring(L,1));
|
||||||
|
else
|
||||||
|
LLUA_INVALID_PARAMETER();
|
||||||
|
|
||||||
|
if(p == NULL) return 0;
|
||||||
|
|
||||||
|
/* Return the class. */
|
||||||
|
buf[0] = planet_getClass(p);
|
||||||
|
buf[1] = '\0';
|
||||||
|
lua_pushstring(L, buf);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int space_planetServices(lua_State* L) {
|
||||||
|
Planet* p;
|
||||||
|
|
||||||
|
LLUA_MIN_ARGS(1);
|
||||||
|
|
||||||
|
/* Get planet. */
|
||||||
|
if(lua_isstring(L, 1))
|
||||||
|
p = planet_get((char*)lua_tostring(L,1));
|
||||||
|
else
|
||||||
|
LLUA_INVALID_PARAMETER();
|
||||||
|
|
||||||
|
if(p == NULL) return 0;
|
||||||
|
|
||||||
|
lua_pushnumber(L, p->services);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* -- Time. -- */
|
/* -- Time. -- */
|
||||||
static int time_get(lua_State* L) {
|
static int time_get(lua_State* L) {
|
||||||
lua_pushnumber(L, ltime_get());
|
lua_pushnumber(L, ltime_get());
|
||||||
|
42
src/space.c
42
src/space.c
@ -187,7 +187,47 @@ static PlanetClass planetclass_get(const char a) {
|
|||||||
case '2' : return STATION_CLASS_C;
|
case '2' : return STATION_CLASS_C;
|
||||||
case '3' : return STATION_CLASS_D;
|
case '3' : return STATION_CLASS_D;
|
||||||
|
|
||||||
default: return PLANET_CLASS_NULL;
|
default:
|
||||||
|
WARN("Invalid planet class.");
|
||||||
|
return PLANET_CLASS_NULL;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
char planet_getClass(Planet* p) {
|
||||||
|
switch(p->class) {
|
||||||
|
case PLANET_CLASS_A: return 'A';
|
||||||
|
case PLANET_CLASS_B: return 'B';
|
||||||
|
case PLANET_CLASS_C: return 'C';
|
||||||
|
case PLANET_CLASS_D: return 'D';
|
||||||
|
case PLANET_CLASS_E: return 'E';
|
||||||
|
case PLANET_CLASS_F: return 'F';
|
||||||
|
case PLANET_CLASS_G: return 'G';
|
||||||
|
case PLANET_CLASS_H: return 'H';
|
||||||
|
case PLANET_CLASS_I: return 'I';
|
||||||
|
case PLANET_CLASS_J: return 'J';
|
||||||
|
case PLANET_CLASS_K: return 'K';
|
||||||
|
case PLANET_CLASS_L: return 'L';
|
||||||
|
case PLANET_CLASS_M: return 'M';
|
||||||
|
case PLANET_CLASS_N: return 'N';
|
||||||
|
case PLANET_CLASS_O: return 'O';
|
||||||
|
case PLANET_CLASS_P: return 'P';
|
||||||
|
case PLANET_CLASS_Q: return 'Q';
|
||||||
|
case PLANET_CLASS_R: return 'R';
|
||||||
|
case PLANET_CLASS_S: return 'S';
|
||||||
|
case PLANET_CLASS_T: return 'T';
|
||||||
|
case PLANET_CLASS_X: return 'X';
|
||||||
|
case PLANET_CLASS_Y: return 'Y';
|
||||||
|
case PLANET_CLASS_Z: return 'Z';
|
||||||
|
|
||||||
|
/* Stations. */
|
||||||
|
case STATION_CLASS_A: return '0';
|
||||||
|
case STATION_CLASS_B: return '1';
|
||||||
|
case STATION_CLASS_C: return '2';
|
||||||
|
case STATION_CLASS_D: return '3';
|
||||||
|
|
||||||
|
default:
|
||||||
|
WARN("Invalid planet class.");
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@ void space_exit(void);
|
|||||||
/* Planet stuff. */
|
/* Planet stuff. */
|
||||||
char* planet_getSystem(char* planetname);
|
char* planet_getSystem(char* planetname);
|
||||||
Planet* planet_get(char* planetname);
|
Planet* planet_get(char* planetname);
|
||||||
|
char planet_getClass(Planet* p);
|
||||||
|
|
||||||
/* Render. */
|
/* Render. */
|
||||||
void space_render(const double dt);
|
void space_render(const double dt);
|
||||||
|
Loading…
Reference in New Issue
Block a user