Skip to content

Commit

Permalink
fix some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
UNSTOP4BLE committed Apr 4, 2024
1 parent 5f43b9f commit 80b19c9
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 51 deletions.
12 changes: 6 additions & 6 deletions assets/songs/bopeebo/config.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"player": "dad",
"playerpos": [100, 100,
100.0, 100.0, 1.0],
"player": "bf",
"playerpos": [400, 260,
80.0, 40.0, 1.0],
"opponent": "dad",
"opponentpos": [180, 200,
0, 0, 1.0],
"opponentpos": [240, 260,
0, 20, 1.0],
"gf": "gf",
"gfpos": [100, 100],
"gfpos": [320, 160],

"back": "stage",

Expand Down
10 changes: 5 additions & 5 deletions assets/songs/fresh/config.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"player": "bf",
"playerpos": [100, 100,
100.0, 100.0, 1.0],
"playerpos": [400, 260,
80.0, 40.0, 1.0],
"opponent": "dad",
"opponentpos": [180, 200,
0, 0, 1.0],
"opponentpos": [240, 260,
0, 20, 1.0],
"gf": "gf",
"gfpos": [100, 100],
"gfpos": [320, 160],

"back": "stage",

Expand Down
Binary file removed assets/songs/frostbite/Voices.ogg
Binary file not shown.
10 changes: 5 additions & 5 deletions assets/songs/frostbite/config.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"player": "bf",
"playerpos": [100, 100,
100.0, 100.0, 1.0],
"playerpos": [400, 260,
80.0, 40.0, 1.0],
"opponent": "dad",
"opponentpos": [180, 200,
0, 0, 1.0],
"opponentpos": [240, 260,
0, 20, 1.0],
"gf": "gf",
"gfpos": [100, 100],
"gfpos": [320, 160],

"back": "stage",

Expand Down
12 changes: 6 additions & 6 deletions assets/songs/no-more-woah/config.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"player": "bf",
"playerpos": [300, 200,
0, 0, 1.0],
"playerpos": [400, 260,
80.0, 40.0, 1.0],
"opponent": "dad",
"opponentpos": [180, 200,
0, 0, 1.0],
"opponentpos": [240, 260,
0, 20, 1.0],
"gf": "gf",
"gfpos": [100, 100],
"gfpos": [320, 160],

"back": "stage",

"next": "null"
"next": "fresh"

}
12 changes: 6 additions & 6 deletions assets/songs/test/config.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"player": "bf",
"playerpos": [100, 100,
100.0, 100.0, 1.0],
"playerpos": [400, 260,
80.0, 40.0, 1.0],
"opponent": "dad",
"opponentpos": [180, 200,
0, 0, 1.0],
"opponentpos": [240, 260,
0, 20, 1.0],
"gf": "gf",
"gfpos": [100, 100],
"gfpos": [320, 160],

"back": "stage",

"next": "null"
"next": "fresh"

}
6 changes: 2 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,15 @@ int main()
GFX::clear(app->screenCol);
#ifndef PSP
SDL_PumpEvents();
#endif
/*

if (Input::windowClosed()) {
// all this should probably be moved to app->quit() or a similar function
SDL_DestroyWindow(app->window);
app->window = NULL;
app->screenSurface = NULL;
SDL_Quit();
abort();
}
*/
#endif
inputDevice.getEvent(app->event);
ASSERTFUNC(app->currentScreen, "screen is NULL");
app->currentScreen->update();
Expand Down
2 changes: 1 addition & 1 deletion src/menu/mainmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MainMenuScreen::MainMenuScreen(void) {
backgroundy.setValue(GFX::SCREEN_HEIGHT/2 - 331/2);
selection = 0;
songs[0] = "bopeebo";
songs[1] = "fresh (currently not implemented)";
songs[1] = "frostbite";
songs[2] = "test";
songs[3] = "no-more-woah";
selectedsong = songs[0];
Expand Down
42 changes: 25 additions & 17 deletions src/playstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "menu/mainmenu.h"

#define CAMERA_ZOOM_OFFSET 0.5
Rating::Rating(std::string name, int hitwindow, float ratingmod, int score, bool splash)
: name(name),
hitWindow(hitwindow),
Expand Down Expand Up @@ -84,7 +85,8 @@ void PlayStateScreen::initscr(std::string song) {
icons = GFX::loadTex("assets/icons.png");
gamecam.camx = 0;
gamecam.camy = 0;
gamecam.zoom = 1;
gamecam.basezoom = 1+CAMERA_ZOOM_OFFSET;
gamecam.zoom = gamecam.basezoom;
hudcam.camx = 0;
hudcam.camy = 0;
hudcam.zoom = 1;
Expand Down Expand Up @@ -115,18 +117,17 @@ PlayStateScreen::PlayStateScreen(std::string song)
}

void PlayStateScreen::Camera::update(float ox, float oy, float oz, float px, float py, float pz) {
if (app->parser.justStep && !(app->parser.curStep % 16))
{
if (app->parser.sections[app->parser.curStep / 16].flag & FLAG_SEC_MUSTHIT) {
camx.setValue(px, 0.3);
camy.setValue(py, 0.3);
zoom.setValue(pz, 0.3);
}
else {
camx.setValue(ox, 0.3);
camy.setValue(oy, 0.3);
zoom.setValue(oz, 0.3);
}
if (app->parser.sections[app->parser.curStep / 16].flag & FLAG_SEC_MUSTHIT) {
camx.setValue(px, 0.2);
camy.setValue(py, 0.2);
basezoom = pz+CAMERA_ZOOM_OFFSET;
zoom.setValue(basezoom, 0.3);
}
else {
camx.setValue(ox, 0.2);
camy.setValue(oy, 0.2);
basezoom = oz+CAMERA_ZOOM_OFFSET;
zoom.setValue(basezoom, 0.3);
}
}

Expand All @@ -144,15 +145,17 @@ void PlayStateScreen::update(void)

if (isPlaying)
{
gamecam.update(opponent->camx, opponent->camy, opponent->camzoom,
player->camx, player->camy, player->camzoom);
if (app->parser.justStep && !(app->parser.curStep % 16))
gamecam.update(opponent->camx, opponent->camy, opponent->camzoom,
player->camx, player->camy, player->camzoom);

//bump hud
if (app->parser.justStep && !(app->parser.curStep % 16)) {
hudcam.zoom.setValue(1.1, 1.0, 0.2);
}
//bump game
if (app->parser.justStep && !(app->parser.curStep % 16)) {
gamecam.zoom.setValue(1.05, 1.0, 0.2);
gamecam.zoom.setValue(gamecam.basezoom+0.05, gamecam.basezoom, 0.2);
}

//limit health
Expand All @@ -173,7 +176,12 @@ void PlayStateScreen::update(void)
if (app->parser.curStep <= 0)
{
if (app->parser.songTime >= 0 && !isPlaying)
{
{
gamecam.update(opponent->camx, opponent->camy, opponent->camzoom,
player->camx, player->camy, player->camzoom);
hudcam.zoom.setValue(1.1, 1.0, 0.2);
gamecam.zoom.setValue(gamecam.basezoom+0.05, gamecam.basezoom, 0.2);

if (inst != NULL)
inst->play();
vocals->play();
Expand Down
1 change: 1 addition & 0 deletions src/playstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class PlayStateScreen : public Screen {
void update(float ox, float oy, float oz, float px, float py, float pz);
Tween<float, QuadInOutEasing, Chrono> camx, camy;
Tween<float, QuadInOutEasing, Chrono> zoom;
float basezoom;
} gamecam, hudcam;
void initscr(std::string song);
void freescr(void);
Expand Down
10 changes: 9 additions & 1 deletion src/psp/gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ Texture *loadTex(const char *path) {
void freeTex(Texture *tex) {
SDL_DestroyTexture(tex);
}

/*
typedef enum
{
SDL_ScaleModeNearest, < nearest pixel sampling
SDL_ScaleModeLinear, < linear filtering
SDL_ScaleModeBest < anisotropic filtering
} SDL_ScaleMode;
*/
template<typename T> void drawTex(Texture* tex, GFX::RECT<int> *Img, GFX::RECT<T> *Disp, float angle, int alpha) {
ASSERTFUNC(tex, "texture is NULL");

Expand All @@ -43,6 +50,7 @@ template<typename T> void drawTex(Texture* tex, GFX::RECT<int> *Img, GFX::RECT<T
SDL_Rect _disp = {static_cast<int>(Disp->x), static_cast<int>(Disp->y), static_cast<int>(Disp->w), static_cast<int>(Disp->h)};

SDL_SetTextureAlphaMod(tex, alpha);
SDL_SetTextureScaleMode(tex, SDL_ScaleModeBest);
ASSERTFUNC(SDL_RenderCopyEx(app->renderer, tex, &_img, &_disp, static_cast<double>(angle), NULL, SDL_FLIP_NONE) >= 0, "failed to display sprite");
}
}
Expand Down

0 comments on commit 80b19c9

Please sign in to comment.