-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forgot to copy over a few files, fixing right now!!!
- Loading branch information
penguin673
committed
May 26, 2008
1 parent
49c5474
commit 0202ac2
Showing
12 changed files
with
519 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Ok, listen up. This is a development build! No guarantees. | ||
|
||
To control: | ||
|
||
Arrow Keys to control the perspective | ||
P to start/pause/resume | ||
|
||
This program is under GPLv3. | ||
|
||
Oh, and you may need OpenGL (in every DirectX if you're using Windows) and GLUT (Windows binaries here: http://www.xmission.com/~nate/glut.html) | ||
|
||
That is all. | ||
|
||
L-Echo (C) 2008 Jeff Chien | ||
|
||
echochrome is a trademark of Sony Computer Entertainment Inc. © 2008 Sony Computer Entertainment Inc. | ||
|
||
"PlayStation?", "PLAYSTATION" and "PS" Family logo are registered trademarks of Sony Computer Entertainment Inc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
// echo_character.cpp | ||
|
||
/* | ||
This file is part of L-Echo. | ||
L-Echo is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
L-Echo is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with L-Echo. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <cstdlib> | ||
#include <iostream> | ||
|
||
#include <echo_math.h> | ||
#include <grid.h> | ||
#include <echo_ns.h> | ||
#include <hole.h> | ||
#include <isect_grid.h> | ||
#include <echo_character.h> | ||
|
||
#define STARTY 30 | ||
#define SPEED_STEP 0.08f | ||
#define SPEED_FALL 0.50f | ||
|
||
echo_char::echo_char() | ||
{ | ||
num_goals = 0; | ||
init(NULL); | ||
} | ||
echo_char::echo_char(grid* g1) | ||
{ | ||
num_goals = 0; | ||
init(g1); | ||
} | ||
|
||
int echo_char::is_paused() | ||
{ | ||
return(paused); | ||
} | ||
|
||
int echo_char::num_goals_reached() | ||
{ | ||
return(num_goals); | ||
} | ||
|
||
void echo_char::change_speed() | ||
{ | ||
if(grid1 && grid2) | ||
{ | ||
if(typeid(*grid1) == typeid(hole) && (typeid(*grid2) == typeid(isect_grid) | ||
|| grid2 == echo_ns::hole_grid)) | ||
{ | ||
std::cout << "falling into hole..." << std::endl; | ||
speed = SPEED_FALL; | ||
} | ||
if(typeid(*grid1) == typeid(isect_grid) | ||
&& typeid(*grid2) != typeid(isect_grid)) | ||
{ | ||
std::cout << "normal speed" << std::endl; | ||
speed = SPEED_STEP; | ||
} | ||
} | ||
} | ||
void echo_char::init(grid * g1) | ||
{ | ||
start = g1; | ||
grid1 = g1; | ||
if(g1) | ||
grid2 = grid1->get_next(echo_ns::angle, grid1); | ||
else | ||
grid2 = NULL; | ||
|
||
paused = 0; | ||
|
||
|
||
grid1per = 1; | ||
grid2per = 0; | ||
startper = 1; | ||
speed = SPEED_STEP; | ||
dist = 1; | ||
change_speed(); | ||
} | ||
|
||
void echo_char::toggle_pause() | ||
{ | ||
paused = !paused; | ||
} | ||
|
||
void echo_char::kill() | ||
{ | ||
startper = -0.05; | ||
} | ||
|
||
void echo_char::reset() | ||
{ | ||
init(start); | ||
} | ||
|
||
void echo_char::next_grid() | ||
{ | ||
if(grid1->is_goal(echo_ns::angle)) | ||
{ | ||
grid1->toggle_goal(echo_ns::angle); | ||
num_goals++; | ||
} | ||
if(grid1 == echo_ns::hole_grid) | ||
kill(); | ||
else if(grid2) | ||
{ | ||
grid *temp = grid2; | ||
grid2 = grid2->get_next(echo_ns::angle, grid1); | ||
if (grid2 == echo_ns::hole_grid) | ||
kill(); | ||
grid1 = temp; | ||
change_speed(); | ||
} | ||
else | ||
grid2 = NULL; | ||
grid1per = 1; | ||
grid2per = 0; | ||
} | ||
|
||
vector3f* echo_char::step() //CHANGE FOR NORMALS | ||
{ | ||
if(startper > 0) | ||
{ | ||
vector3f pos1 = start->get_info(echo_ns::angle)->pos; | ||
startper -= 0.05; | ||
if (startper < 0) | ||
startper = 0; | ||
return(new vector3f(pos1.x, pos1.y + STARTY * startper, pos1.z)); | ||
} | ||
else if(startper < 0) | ||
{ | ||
vector3f pos1 = grid1->get_info(echo_ns::angle)->pos; | ||
startper -= 0.05; | ||
if(startper < -1) | ||
init(start); | ||
return(new vector3f(pos1.x, pos1.y + STARTY * startper, pos1.z)); | ||
} | ||
else if(grid1) | ||
{ | ||
if (grid2 == echo_ns::hole_grid) | ||
kill(); | ||
else | ||
{ | ||
if(grid1->is_goal(echo_ns::angle)) | ||
{ | ||
grid1->toggle_goal(echo_ns::angle); | ||
num_goals++; | ||
} | ||
if(grid1 && grid2 && !paused) //if both grids are there | ||
{ | ||
grid1per -= speed / dist; //step thru it | ||
grid2per += speed / dist; | ||
if (grid1per <= 0) //if we've reached the end of this cycle | ||
{ | ||
next_grid(); //on to the next cycle | ||
} | ||
} | ||
if(grid1 && !grid2) //if there isn't a second grid... | ||
{ | ||
grid2 = grid1->get_next(echo_ns::angle, grid1); //try to get one | ||
change_speed(); | ||
if(!grid2) //if there still isn't a second grid... | ||
return(new vector3f(grid1->get_info(echo_ns::angle)->pos)); //return grid1's position | ||
} | ||
grid_info_t *i1 = grid1->get_info(echo_ns::angle); | ||
if(i1) | ||
{ | ||
vector3f pos1 = i1->pos; | ||
grid_info_t *i2 = grid2->get_info(echo_ns::angle); | ||
if(i2) | ||
{ | ||
vector3f pos2 = i2->pos; | ||
dist = pos1.dist(pos2); | ||
/* | ||
ret->dump(); | ||
std::cout <<std::endl; | ||
// */ | ||
return(new vector3f(pos1.x * grid1per + pos2.x * grid2per, | ||
pos1.y * grid1per + pos2.y * grid2per, | ||
pos1.z * grid1per + pos2.z * grid2per)); | ||
} | ||
return(new vector3f(i1->pos)); //there isn't a second grid? but wait, wouldn't this be return already? | ||
} | ||
} | ||
} | ||
return(NULL); //i dunno why this would happen, but sure... | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// echo_character.h | ||
|
||
/* | ||
This file is part of L-Echo. | ||
L-Echo is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
L-Echo is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with L-Echo. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <echo_math.h> | ||
#include <grid.h> | ||
#include <echo_stage.h> | ||
|
||
#ifndef __ECHO_CHARACTER__ | ||
#define __ECHO_CHARACTER__ | ||
class echo_char | ||
{ | ||
protected: | ||
grid* start; | ||
grid* grid1; | ||
grid* grid2; | ||
int paused; | ||
int num_goals; | ||
float grid1per, grid2per, startper, speed, dist; | ||
|
||
public: | ||
echo_char(); | ||
echo_char(grid* start); | ||
void init(grid* g1); | ||
void reset(); | ||
|
||
vector3f* step(); | ||
void kill(); | ||
void toggle_pause(); | ||
void next_grid(); | ||
void change_speed(); | ||
int is_paused(); | ||
int num_goals_reached(); | ||
}; | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" standalone="no" ?> | ||
<stage name="hole demo" start="top3" goals="0"> | ||
<grid id="top1" x="-1" y="2" z="0" prev="top2" next="top2" /> | ||
<grid id="top2" x="0" y="2" z="0" prev="top1" next="top3" /> | ||
<hole id="top3" x="1" y="2" z="0" prev="top2" next="top2" /> | ||
|
||
<grid id="bottom1" x="-1" y="-2" z="0" prev="NONE" next="NONE" /> | ||
<grid id="bottom2" x="0" y="-2" z="-1" prev="NONE" next="NONE" /> | ||
<grid id="bottom4" x="0" y="-2" z="1" prev="NONE" next="NONE" /> | ||
|
||
<grid id="bottom11" x="-1" y="-4" z="0" prev="NONE" next="NONE" /> | ||
<grid id="bottom12" x="0" y="-4" z="-1" prev="NONE" next="NONE" /> | ||
<grid id="bottom13" x="1" y="-4" z="0" prev="NONE" next="NONE" /> | ||
<grid id="bottom14" x="0" y="-4" z="1" prev="NONE" next="NONE" /> | ||
</stage> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// isect_grid.cpp | ||
|
||
/* | ||
This file is part of L-Echo. | ||
L-Echo is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
L-Echo is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with L-Echo. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <iostream> | ||
|
||
#include <echo_ns.h> | ||
#include <echo_math.h> | ||
#include <grid.h> | ||
#include <static_grid.h> | ||
#include <isect_grid.h> | ||
#include <echo_stage.h> | ||
|
||
isect_grid::isect_grid() | ||
{ | ||
} | ||
isect_grid::isect_grid(grid_info_t* my_info, grid* my_prev, grid* my_next, vector3f camera, GRID_PTR_SET* my_level) | ||
{ | ||
init(my_info, my_prev, my_next, camera, my_level); | ||
} | ||
void isect_grid::init(grid_info_t* my_info, grid* my_prev, grid* my_next, vector3f camera, GRID_PTR_SET* my_level) | ||
{ | ||
level_y = my_info->pos.y; | ||
static_grid::init(my_info, my_prev, my_next, camera); | ||
level = my_level; | ||
} | ||
|
||
grid* isect_grid::get_next(vector3f angle, grid* current) | ||
{ | ||
refresh(angle); | ||
GRID_PTR_SET::iterator it = level->begin(), end = level->end(); | ||
vector3f prev_pos = get_real_prev()->get_info(angle)->pos; | ||
vector3f vec = ginfo->pos - prev_pos; | ||
float delta_y = level_y - prev_pos.y; | ||
if((delta_y > 0 && vec.y < 0) || (delta_y < 0 && vec.y > 0)) | ||
return(grid::get_next(angle, current)); | ||
vec = vec * (delta_y / vec.y); | ||
vector3f end_pt = prev_pos + vec; | ||
/* | ||
std::cout << "end_pt: " << std::endl; | ||
end_pt.dump(); | ||
std::cout << std::endl; | ||
// */ | ||
while(it != end) | ||
{ | ||
grid* g = *it; | ||
if(g->is_pt_on(angle,end_pt)) | ||
{ | ||
return(g); | ||
} | ||
it++; | ||
} | ||
return(grid::get_next(angle, current)); | ||
} | ||
|
||
|
Oops, something went wrong.