Merge pull request #23 from Clownacy/master
Merge Clownacy/master into master
This commit is contained in:
commit
f9d62f38ef
52 changed files with 297 additions and 187 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -16,13 +16,13 @@ msvc2003/devilution/compare.asm
|
|||
|
||||
# Exclude build output on Linux (exclude normally produced executable files and out files)
|
||||
build_en/CSE2
|
||||
build_en/CSE2d
|
||||
build_en/CSE2_debug
|
||||
build_en/DoConfig
|
||||
build_en/DoConfigd
|
||||
build_en/DoConfig_debug
|
||||
build_jp/CSE2
|
||||
build_jp/CSE2d
|
||||
build_jp/CSE2_debug
|
||||
build_jp/DoConfig
|
||||
build_jp/DoConfigd
|
||||
build_jp/DoConfig_debug
|
||||
build_en/*.out
|
||||
build_jp/*.out
|
||||
|
||||
|
|
|
@ -263,10 +263,7 @@ elseif(NOT WIN32)
|
|||
endif()
|
||||
|
||||
# Magic to convert resources to header files
|
||||
add_executable(bin2h "src/misc/bin2h.c")
|
||||
if(MSVC)
|
||||
target_compile_definitions(bin2h PRIVATE _CRT_SECURE_NO_WARNINGS) # Shut up those stupid warnings
|
||||
endif()
|
||||
add_subdirectory("bin2h")
|
||||
foreach(FILENAME IN LISTS RESOURCES)
|
||||
set(IN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/res")
|
||||
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/Resource")
|
||||
|
@ -294,10 +291,8 @@ set_target_properties(CSE2 PROPERTIES
|
|||
CXX_EXTENSIONS OFF
|
||||
)
|
||||
|
||||
# Name debug builds "CSE2d", to distinguish them
|
||||
set_target_properties(CSE2 PROPERTIES
|
||||
DEBUG_OUTPUT_NAME "CSE2d"
|
||||
)
|
||||
# Name debug builds "CSE2_debug", to distinguish them
|
||||
set_target_properties(CSE2 PROPERTIES DEBUG_OUTPUT_NAME "CSE2_debug")
|
||||
|
||||
# Send executable to the build_en/build_jp directory
|
||||
set_target_properties(CSE2 PROPERTIES
|
||||
|
@ -372,6 +367,9 @@ endif()
|
|||
|
||||
add_subdirectory("DoConfig")
|
||||
|
||||
# Name debug builds "DoConfig_debug", to distinguish them
|
||||
set_target_properties(DoConfig PROPERTIES DEBUG_OUTPUT_NAME "DoConfig_debug")
|
||||
|
||||
# Send executable to the build_en/build_jp directory
|
||||
set_target_properties(DoConfig PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${BUILD_DIRECTORY}
|
||||
|
|
|
@ -10,9 +10,6 @@ project(DoConfig LANGUAGES CXX)
|
|||
|
||||
add_executable(DoConfig "DoConfig.cpp" "icon.rc")
|
||||
|
||||
# Name debug builds "DoConfigd", to distinguish them
|
||||
set_target_properties(CSE2 PROPERTIES DEBUG_OUTPUT_NAME "DoConfigd")
|
||||
|
||||
# Windows tweak
|
||||
if(WIN32)
|
||||
set_target_properties(DoConfig PROPERTIES WIN32_EXECUTABLE YES) # Disable the console window
|
||||
|
|
|
@ -5,14 +5,17 @@
|
|||
* http://sam.zoy.org/wtfpl/COPYING for more details. */
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
#include "FL/Fl.H"
|
||||
#include "FL/Fl_Window.H"
|
||||
#include "FL/Fl_Radio_Round_Button.H"
|
||||
#include "FL/Fl_Choice.H"
|
||||
#include "FL/Fl_Check_Button.H"
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Menu_Item.H>
|
||||
#include <FL/Fl_Round_Button.H>
|
||||
#include <FL/Enumerations.H>
|
||||
|
||||
#define MAGIC "DOUKUTSU20041206"
|
||||
#define FONT "Courier New"
|
||||
|
|
6
Makefile
6
Makefile
|
@ -4,7 +4,7 @@ ifeq ($(RELEASE), 1)
|
|||
FILENAME_DEF = CSE2
|
||||
else
|
||||
CXXFLAGS = -Og -g3
|
||||
FILENAME_DEF = CSE2d
|
||||
FILENAME_DEF = CSE2_debug
|
||||
endif
|
||||
|
||||
ifeq ($(JAPANESE), 1)
|
||||
|
@ -226,10 +226,10 @@ src/Resource/%.h: res/% obj/bin2h
|
|||
@echo Converting $<
|
||||
@obj/bin2h $< $@
|
||||
|
||||
obj/bin2h: src/misc/bin2h.c
|
||||
obj/bin2h: bin2h/bin2h.c
|
||||
@mkdir -p $(@D)
|
||||
@echo Compiling $^
|
||||
@$(CC) -O3 -s -std=c90 $^ -o $@
|
||||
@$(CC) -O3 -s -std=c90 -Wall -Wextra -pedantic $^ -o $@
|
||||
|
||||
include $(wildcard $(DEPENDENCIES))
|
||||
|
||||
|
|
31
bin2h/CMakeLists.txt
Normal file
31
bin2h/CMakeLists.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
cmake_minimum_required(VERSION 3.7.2)
|
||||
|
||||
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
endif()
|
||||
|
||||
project(bin2h LANGUAGES C)
|
||||
|
||||
add_executable(bin2h "bin2h.c")
|
||||
|
||||
set_target_properties(bin2h PROPERTIES
|
||||
C_STANDARD 90
|
||||
C_STANDARD_REQUIRED ON
|
||||
C_EXTENSIONS OFF
|
||||
)
|
||||
|
||||
# MSVC tweak
|
||||
if(MSVC)
|
||||
target_compile_definitions(bin2h PRIVATE _CRT_SECURE_NO_WARNINGS) # Shut up those stupid warnings
|
||||
endif()
|
||||
|
||||
# Enable link-time optimisation if available
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT result)
|
||||
if(result)
|
||||
set_target_properties(bin2h PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
|
@ -29,7 +29,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
filename_pointer = (last_path_seperator == NULL) ? argv[1] : last_path_seperator + 1;
|
||||
dot = strchr(filename_pointer, '.');
|
||||
filename_length = (dot == NULL) ? strlen(filename_pointer) : dot - filename_pointer;
|
||||
filename_length = (dot == NULL) ? strlen(filename_pointer) : (size_t)(dot - filename_pointer);
|
||||
|
||||
filename = malloc(filename_length + 1);
|
||||
memcpy(filename, filename_pointer, filename_length);
|
||||
|
@ -65,17 +65,17 @@ int main(int argc, char *argv[])
|
|||
|
||||
setvbuf(out_file, NULL, _IOFBF, 0x10000);
|
||||
|
||||
fprintf(out_file, "#pragma once\n\nconst unsigned char r%s[0x%lX] = {\n\t", filename, in_file_size);
|
||||
fprintf(out_file, "#pragma once\n\nstatic const unsigned char r%s[0x%lX] = {\n\t", filename, in_file_size);
|
||||
|
||||
for (i = 0; i < in_file_size - 1; ++i)
|
||||
{
|
||||
if (i % 16 == 15)
|
||||
fprintf(out_file, "0x%02X,\n\t", *in_file_pointer++);
|
||||
if (i % 32 == 32-1)
|
||||
fprintf(out_file, "%d,\n\t", *in_file_pointer++);
|
||||
else
|
||||
fprintf(out_file, "0x%02X, ", *in_file_pointer++);
|
||||
fprintf(out_file, "%d,", *in_file_pointer++);
|
||||
}
|
||||
|
||||
fprintf(out_file, "0x%02X\n};\n", *in_file_pointer++);
|
||||
fprintf(out_file, "%d\n};\n", *in_file_pointer++);
|
||||
|
||||
fclose(out_file);
|
||||
free(in_file_buffer);
|
|
@ -1,9 +1,11 @@
|
|||
#include "Back.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "CommonDefines.h"
|
||||
#include "Draw.h"
|
||||
#include "File.h"
|
||||
#include "Frame.h"
|
||||
|
@ -250,7 +252,7 @@ void PutFront(int fx, int fy)
|
|||
// Draw black bars
|
||||
if (!(g_GameFlags & 8)) // Detect if credits are running
|
||||
{
|
||||
const bool fromFocus = (gStageNo == 31); // Get if we should only draw around a 320x240 area of the focus point
|
||||
const BOOL fromFocus = (gStageNo == 31); // Get if we should only draw around a 320x240 area of the focus point
|
||||
|
||||
// Get focus rect
|
||||
int focusX = gFrame.x + (WINDOW_WIDTH << 8) - (320 << 8);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "Frame.h"
|
||||
#include "Game.h"
|
||||
#include "MyChar.h"
|
||||
#include "NpChar.h"
|
||||
#include "Sound.h"
|
||||
|
||||
void ActBossChar_Ironhead(void)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "Boss.h"
|
||||
#include "Game.h"
|
||||
#include "Map.h"
|
||||
#include "NpChar.h"
|
||||
#include "Sound.h"
|
||||
|
||||
void ActBossChar_Press(void)
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
#include "BulHit.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
#include "Game.h"
|
||||
#include "Map.h"
|
||||
#include "MyChar.h"
|
||||
#include "NpChar.h"
|
||||
#include "Sound.h"
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "Config.h"
|
||||
#include "File.h"
|
||||
#include "Tags.h"
|
||||
#include "Types.h"
|
||||
|
||||
static const char* const config_filename = "Config.dat"; // Not the original name
|
||||
static const char* const config_magic = "DOUKUTSU20041206"; // Not the original name
|
||||
|
|
68
src/Draw.cpp
68
src/Draw.cpp
|
@ -1,5 +1,8 @@
|
|||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#ifdef WINDOWS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
@ -23,12 +26,11 @@
|
|||
#include "Font.h"
|
||||
#include "Resource.h"
|
||||
#include "Tags.h"
|
||||
#include "Types.h"
|
||||
|
||||
struct SURFACE
|
||||
{
|
||||
bool in_use;
|
||||
bool needs_updating;
|
||||
BOOL in_use;
|
||||
BOOL needs_updating;
|
||||
SDL_Surface *surface;
|
||||
SDL_Texture *texture;
|
||||
};
|
||||
|
@ -40,7 +42,7 @@ RECT grcGame = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
|
|||
RECT grcFull = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
|
||||
|
||||
int magnification;
|
||||
bool fullscreen;
|
||||
BOOL fullscreen;
|
||||
|
||||
SURFACE surf[SURFACE_ID_MAX];
|
||||
|
||||
|
@ -52,7 +54,7 @@ BOOL Flip_SystemTask(int hWnd)
|
|||
{
|
||||
(void)hWnd;
|
||||
|
||||
while (true)
|
||||
while (TRUE)
|
||||
{
|
||||
if (!SystemTask())
|
||||
return FALSE;
|
||||
|
@ -99,17 +101,17 @@ BOOL StartDirectDraw(int lMagnification, int lColourDepth)
|
|||
{
|
||||
case 0:
|
||||
magnification = 1;
|
||||
fullscreen = false;
|
||||
fullscreen = FALSE;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
magnification = 2;
|
||||
fullscreen = false;
|
||||
fullscreen = FALSE;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
magnification = 2;
|
||||
fullscreen = true;
|
||||
fullscreen = TRUE;
|
||||
SDL_SetWindowFullscreen(gWindow, SDL_WINDOW_FULLSCREEN);
|
||||
break;
|
||||
}
|
||||
|
@ -129,7 +131,7 @@ void EndDirectDraw()
|
|||
ReleaseSurface(i);
|
||||
}
|
||||
|
||||
static bool IsEnableBitmap(SDL_RWops *fp)
|
||||
static BOOL IsEnableBitmap(SDL_RWops *fp)
|
||||
{
|
||||
char str[16];
|
||||
const char *extra_text = "(C)Pixel";
|
||||
|
@ -149,7 +151,7 @@ void ReleaseSurface(int s)
|
|||
{
|
||||
SDL_DestroyTexture(surf[s].texture);
|
||||
SDL_FreeSurface(surf[s].surface);
|
||||
surf[s].in_use = false;
|
||||
surf[s].in_use = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +171,7 @@ BOOL MakeSurface_Generic(int bxsize, int bysize, Surface_Ids surf_no, BOOL bSyst
|
|||
}
|
||||
else
|
||||
{
|
||||
if (surf[surf_no].in_use == true)
|
||||
if (surf[surf_no].in_use == TRUE)
|
||||
{
|
||||
printf("Tried to create drawable surface at occupied slot (%d)\n", surf_no);
|
||||
}
|
||||
|
@ -194,7 +196,7 @@ BOOL MakeSurface_Generic(int bxsize, int bysize, Surface_Ids surf_no, BOOL bSyst
|
|||
}
|
||||
else
|
||||
{
|
||||
surf[surf_no].in_use = true;
|
||||
surf[surf_no].in_use = TRUE;
|
||||
success = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -231,9 +233,9 @@ static void FlushSurface(Surface_Ids surf_no)
|
|||
SDL_UnlockTexture(surf[surf_no].texture);
|
||||
}
|
||||
|
||||
static bool LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, bool create_surface)
|
||||
static BOOL LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, BOOL create_surface)
|
||||
{
|
||||
bool success = false;
|
||||
BOOL success = FALSE;
|
||||
|
||||
if (surf_no >= SURFACE_ID_MAX)
|
||||
{
|
||||
|
@ -255,15 +257,15 @@ static bool LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, bool create_surface)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (create_surface == false || MakeSurface_Generic(surface->w, surface->h, surf_no, FALSE))
|
||||
if (create_surface == FALSE || MakeSurface_Generic(surface->w, surface->h, surf_no, FALSE))
|
||||
{
|
||||
if (magnification == 1)
|
||||
{
|
||||
SDL_Rect dst_rect = {0, 0, surface->w, surface->h};
|
||||
SDL_BlitSurface(surface, NULL, surf[surf_no].surface, &dst_rect);
|
||||
surf[surf_no].needs_updating = true;
|
||||
surf[surf_no].needs_updating = TRUE;
|
||||
printf(" ^ Successfully loaded\n");
|
||||
success = true;
|
||||
success = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -301,9 +303,9 @@ static bool LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, bool create_surface)
|
|||
}
|
||||
|
||||
SDL_FreeSurface(converted_surface);
|
||||
surf[surf_no].needs_updating = true;
|
||||
surf[surf_no].needs_updating = TRUE;
|
||||
printf(" ^ Successfully loaded\n");
|
||||
success = true;
|
||||
success = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +320,7 @@ static bool LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, bool create_surface)
|
|||
return success;
|
||||
}
|
||||
|
||||
static BOOL LoadBitmap_File(const char *name, Surface_Ids surf_no, bool create_surface)
|
||||
static BOOL LoadBitmap_File(const char *name, Surface_Ids surf_no, BOOL create_surface)
|
||||
{
|
||||
char path[PATH_LENGTH];
|
||||
SDL_RWops *fp;
|
||||
|
@ -355,7 +357,7 @@ static BOOL LoadBitmap_File(const char *name, Surface_Ids surf_no, bool create_s
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL LoadBitmap_Resource(const char *res, Surface_Ids surf_no, bool create_surface)
|
||||
static BOOL LoadBitmap_Resource(const char *res, Surface_Ids surf_no, BOOL create_surface)
|
||||
{
|
||||
size_t size;
|
||||
const unsigned char *data = FindResource(res, "BITMAP", &size);
|
||||
|
@ -378,22 +380,22 @@ static BOOL LoadBitmap_Resource(const char *res, Surface_Ids surf_no, bool creat
|
|||
|
||||
BOOL MakeSurface_File(const char *name, Surface_Ids surf_no)
|
||||
{
|
||||
return LoadBitmap_File(name, surf_no, true);
|
||||
return LoadBitmap_File(name, surf_no, TRUE);
|
||||
}
|
||||
|
||||
BOOL MakeSurface_Resource(const char *res, Surface_Ids surf_no)
|
||||
{
|
||||
return LoadBitmap_Resource(res, surf_no, true);
|
||||
return LoadBitmap_Resource(res, surf_no, TRUE);
|
||||
}
|
||||
|
||||
BOOL ReloadBitmap_File(const char *name, Surface_Ids surf_no)
|
||||
{
|
||||
return LoadBitmap_File(name, surf_no, false);
|
||||
return LoadBitmap_File(name, surf_no, FALSE);
|
||||
}
|
||||
|
||||
BOOL ReloadBitmap_Resource(const char *res, Surface_Ids surf_no)
|
||||
{
|
||||
return LoadBitmap_Resource(res, surf_no, false);
|
||||
return LoadBitmap_Resource(res, surf_no, FALSE);
|
||||
}
|
||||
|
||||
static SDL_Rect RectToSDLRect(RECT *rect)
|
||||
|
@ -431,18 +433,18 @@ void BackupSurface(Surface_Ids surf_no, RECT *rect)
|
|||
SDL_Rect frameRect = RectToSDLRectScaled(rect);
|
||||
|
||||
SDL_BlitSurface(surface, &frameRect, surf[surf_no].surface, &frameRect);
|
||||
surf[surf_no].needs_updating = true;
|
||||
surf[surf_no].needs_updating = TRUE;
|
||||
|
||||
// Free surface
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
|
||||
static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no, bool transparent)
|
||||
static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no, BOOL transparent)
|
||||
{
|
||||
if (surf[surf_no].needs_updating)
|
||||
{
|
||||
FlushSurface(surf_no);
|
||||
surf[surf_no].needs_updating = false;
|
||||
surf[surf_no].needs_updating = FALSE;
|
||||
}
|
||||
|
||||
// Get SDL_Rects
|
||||
|
@ -467,12 +469,12 @@ static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_
|
|||
|
||||
void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) // Transparency
|
||||
{
|
||||
DrawBitmap(rcView, x, y, rect, surf_no, true);
|
||||
DrawBitmap(rcView, x, y, rect, surf_no, TRUE);
|
||||
}
|
||||
|
||||
void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) // No Transparency
|
||||
{
|
||||
DrawBitmap(rcView, x, y, rect, surf_no, false);
|
||||
DrawBitmap(rcView, x, y, rect, surf_no, FALSE);
|
||||
}
|
||||
|
||||
void Surface2Surface(int x, int y, RECT *rect, int to, int from)
|
||||
|
@ -482,7 +484,7 @@ void Surface2Surface(int x, int y, RECT *rect, int to, int from)
|
|||
SDL_Rect frameRect = RectToSDLRectScaled(rect);
|
||||
|
||||
SDL_BlitSurface(surf[from].surface, &frameRect, surf[to].surface, &rcSet);
|
||||
surf[to].needs_updating = true;
|
||||
surf[to].needs_updating = TRUE;
|
||||
}
|
||||
|
||||
unsigned long GetCortBoxColor(unsigned long col)
|
||||
|
@ -514,7 +516,7 @@ void CortBox2(RECT *rect, unsigned long col, Surface_Ids surf_no)
|
|||
const unsigned char col_green = (unsigned char)((col >> 8) & 0xFF);
|
||||
const unsigned char col_blue = (unsigned char)((col >> 16) & 0xFF);
|
||||
SDL_FillRect(surf[surf_no].surface, &destRect, SDL_MapRGB(surf[surf_no].surface->format, col_red, col_green, col_blue));
|
||||
surf[surf_no].needs_updating = true;
|
||||
surf[surf_no].needs_updating = TRUE;
|
||||
}
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
@ -635,7 +637,7 @@ void PutText(int x, int y, const char *text, unsigned long color)
|
|||
void PutText2(int x, int y, const char *text, unsigned long color, Surface_Ids surf_no)
|
||||
{
|
||||
DrawText(gFont, (unsigned char*)surf[surf_no].surface->pixels, surf[surf_no].surface->pitch, surf[surf_no].surface->w, surf[surf_no].surface->h, x * magnification, y * magnification, color, text, strlen(text));
|
||||
surf[surf_no].needs_updating = true;
|
||||
surf[surf_no].needs_updating = TRUE;
|
||||
}
|
||||
|
||||
void EndTextObject()
|
||||
|
|
|
@ -10,7 +10,7 @@ extern RECT grcGame;
|
|||
extern RECT grcFull;
|
||||
|
||||
extern int magnification;
|
||||
extern bool fullscreen;
|
||||
extern BOOL fullscreen;
|
||||
|
||||
typedef enum Surface_Ids
|
||||
{
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "CommonDefines.h"
|
||||
|
||||
struct CREDIT
|
||||
{
|
||||
int size;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Draw.h"
|
||||
#include "Game.h"
|
||||
|
||||
#define FADE_WIDTH (((WINDOW_WIDTH - 1) / 16) + 1)
|
||||
#define FADE_HEIGHT (((WINDOW_HEIGHT - 1) / 16) + 1)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -11,6 +10,8 @@
|
|||
#include FT_LCD_FILTER_H
|
||||
#include FT_BITMAP_H
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "File.h"
|
||||
|
||||
// Uncomment for that authentic pre-Windows Vista feel
|
||||
|
@ -39,7 +40,7 @@ typedef struct FontObject
|
|||
FT_Face face;
|
||||
unsigned char *data;
|
||||
#ifndef DISABLE_FONT_ANTIALIASING
|
||||
bool lcd_mode;
|
||||
BOOL lcd_mode;
|
||||
#endif
|
||||
CachedGlyph *glyph_list_head;
|
||||
} FontObject;
|
||||
|
|
114
src/Frame.cpp
114
src/Frame.cpp
|
@ -1,7 +1,5 @@
|
|||
#include "Frame.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "Boss.h"
|
||||
#include "CommonDefines.h"
|
||||
#include "Game.h"
|
||||
|
@ -16,7 +14,7 @@ void MoveFrame3()
|
|||
short map_w, map_l;
|
||||
GetMapData(0, &map_w, &map_l);
|
||||
|
||||
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240 // TODO - Really need to make this a compiler flag
|
||||
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240 // TODO - Really need to make this a compiler flag (also, should probably move this stuff to the enhanced branch)
|
||||
if (g_GameFlags & 8)
|
||||
{
|
||||
// Use the original camera boundaries during the credits
|
||||
|
@ -41,7 +39,7 @@ void MoveFrame3()
|
|||
// Widescreen/tallscreen-safe behaviour
|
||||
if (map_w * 0x10 < WINDOW_WIDTH)
|
||||
{
|
||||
gFrame.x = -((WINDOW_WIDTH - map_w * 0x10) * 0x200 / 2);
|
||||
gFrame.x = -(((WINDOW_WIDTH - (map_w - 1) * 0x10) * 0x200) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -56,7 +54,7 @@ void MoveFrame3()
|
|||
|
||||
if (map_l * 0x10 < WINDOW_HEIGHT)
|
||||
{
|
||||
gFrame.y = -((WINDOW_HEIGHT - map_l * 0x10) * 0x200 / 2);
|
||||
gFrame.y = -(((WINDOW_HEIGHT - (map_l - 1) * 0x10) * 0x200) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -126,15 +124,64 @@ void SetFramePosition(int fx, int fy)
|
|||
gFrame.y = fy;
|
||||
|
||||
// Keep in bounds
|
||||
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240
|
||||
if (g_GameFlags & 8)
|
||||
{
|
||||
// Use the original camera boundaries during the credits
|
||||
if (gFrame.x / 0x200 < 0)
|
||||
gFrame.x = 0;
|
||||
if (gFrame.y / 0x200 < 0)
|
||||
gFrame.y = 0;
|
||||
|
||||
if (gFrame.x > ((map_w - 1) * 0x10 - 320) * 0x200)
|
||||
gFrame.x = ((map_w - 1) * 0x10 - 320) * 0x200;
|
||||
if (gFrame.y > ((map_l - 1) * 0x10 - 240) * 0x200)
|
||||
gFrame.y = ((map_l - 1) * 0x10 - 240) * 0x200;
|
||||
|
||||
gFrame.x -= ((WINDOW_WIDTH - 320) / 2) * 0x200;
|
||||
gFrame.y -= ((WINDOW_HEIGHT - 240) / 2) * 0x200;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Widescreen/tallscreen-safe behaviour
|
||||
if (map_w * 0x10 < WINDOW_WIDTH)
|
||||
{
|
||||
gFrame.x = -(((WINDOW_WIDTH - (map_w - 1) * 0x10) * 0x200) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gFrame.x / 0x200 < 0)
|
||||
gFrame.x = 0;
|
||||
|
||||
if (gFrame.x > ((map_w - 1) * 0x10 - WINDOW_WIDTH) * 0x200)
|
||||
gFrame.x = ((map_w - 1) * 0x10 - WINDOW_WIDTH) * 0x200;
|
||||
}
|
||||
|
||||
if (map_l * 0x10 < WINDOW_HEIGHT)
|
||||
{
|
||||
gFrame.y = -(((WINDOW_HEIGHT - (map_l - 1) * 0x10) * 0x200) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gFrame.y / 0x200 < 0)
|
||||
gFrame.y = 0;
|
||||
|
||||
if (gFrame.y > ((map_l - 1) * 0x10 - WINDOW_HEIGHT) * 0x200)
|
||||
gFrame.y = ((map_l - 1) * 0x10 - WINDOW_HEIGHT) * 0x200;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Vanilla behaviour
|
||||
if (gFrame.x / 0x200 < 0)
|
||||
gFrame.x = 0;
|
||||
if (gFrame.y / 0x200 < 0)
|
||||
gFrame.y = 0;
|
||||
|
||||
if (gFrame.x > ((((map_w - 1) * 0x10) - WINDOW_WIDTH)) * 0x200)
|
||||
if (gFrame.x > (((map_w - 1) * 0x10) - WINDOW_WIDTH) * 0x200)
|
||||
gFrame.x = (((map_w - 1) * 0x10) - WINDOW_WIDTH) * 0x200;
|
||||
if (gFrame.y > ((((map_l - 1) * 0x10) - WINDOW_HEIGHT)) * 0x200)
|
||||
if (gFrame.y > (((map_l - 1) * 0x10) - WINDOW_HEIGHT) * 0x200)
|
||||
gFrame.y = (((map_l - 1) * 0x10) - WINDOW_HEIGHT) * 0x200;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetFrameMyChar()
|
||||
|
@ -150,15 +197,64 @@ void SetFrameMyChar()
|
|||
gFrame.y = mc_y - (WINDOW_HEIGHT << 8);
|
||||
|
||||
// Keep in bounds
|
||||
#if WINDOW_WIDTH != 320 || WINDOW_HEIGHT != 240
|
||||
if (g_GameFlags & 8)
|
||||
{
|
||||
// Use the original camera boundaries during the credits
|
||||
if (gFrame.x / 0x200 < 0)
|
||||
gFrame.x = 0;
|
||||
if (gFrame.y / 0x200 < 0)
|
||||
gFrame.y = 0;
|
||||
|
||||
if (gFrame.x > ((map_w - 1) * 0x10 - 320) * 0x200)
|
||||
gFrame.x = ((map_w - 1) * 0x10 - 320) * 0x200;
|
||||
if (gFrame.y > ((map_l - 1) * 0x10 - 240) * 0x200)
|
||||
gFrame.y = ((map_l - 1) * 0x10 - 240) * 0x200;
|
||||
|
||||
gFrame.x -= ((WINDOW_WIDTH - 320) / 2) * 0x200;
|
||||
gFrame.y -= ((WINDOW_HEIGHT - 240) / 2) * 0x200;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Widescreen/tallscreen-safe behaviour
|
||||
if (map_w * 0x10 < WINDOW_WIDTH)
|
||||
{
|
||||
gFrame.x = -(((WINDOW_WIDTH - (map_w - 1) * 0x10) * 0x200) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gFrame.x / 0x200 < 0)
|
||||
gFrame.x = 0;
|
||||
|
||||
if (gFrame.x > ((map_w - 1) * 0x10 - WINDOW_WIDTH) * 0x200)
|
||||
gFrame.x = ((map_w - 1) * 0x10 - WINDOW_WIDTH) * 0x200;
|
||||
}
|
||||
|
||||
if (map_l * 0x10 < WINDOW_HEIGHT)
|
||||
{
|
||||
gFrame.y = -(((WINDOW_HEIGHT - (map_l - 1) * 0x10) * 0x200) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gFrame.y / 0x200 < 0)
|
||||
gFrame.y = 0;
|
||||
|
||||
if (gFrame.y > ((map_l - 1) * 0x10 - WINDOW_HEIGHT) * 0x200)
|
||||
gFrame.y = ((map_l - 1) * 0x10 - WINDOW_HEIGHT) * 0x200;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Vanilla behaviour
|
||||
if (gFrame.x / 0x200 < 0)
|
||||
gFrame.x = 0;
|
||||
if (gFrame.y / 0x200 < 0)
|
||||
gFrame.y = 0;
|
||||
|
||||
if (gFrame.x > ((((map_w - 1) * 0x10) - WINDOW_WIDTH)) * 0x200)
|
||||
if (gFrame.x > (((map_w - 1) * 0x10) - WINDOW_WIDTH) * 0x200)
|
||||
gFrame.x = (((map_w - 1) * 0x10) - WINDOW_WIDTH) * 0x200;
|
||||
if (gFrame.y > ((((map_l - 1) * 0x10) - WINDOW_HEIGHT)) * 0x200)
|
||||
if (gFrame.y > (((map_l - 1) * 0x10) - WINDOW_HEIGHT) * 0x200)
|
||||
gFrame.y = (((map_l - 1) * 0x10) - WINDOW_HEIGHT) * 0x200;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetFrameTargetMyChar(int wait)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#include "Game.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <SDL_timer.h>
|
||||
|
||||
|
@ -15,6 +14,7 @@
|
|||
#include "BulHit.h"
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
#include "CommonDefines.h"
|
||||
#include "Draw.h"
|
||||
#include "Ending.h"
|
||||
#include "Escape.h"
|
||||
|
@ -35,7 +35,6 @@
|
|||
#include "NpChar.h"
|
||||
#include "NpcHit.h"
|
||||
#include "NpcTbl.h"
|
||||
#include "Organya.h"
|
||||
#include "Profile.h"
|
||||
#include "SelStage.h"
|
||||
#include "Shoot.h"
|
||||
|
|
|
@ -3,14 +3,10 @@
|
|||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <SDL.h>
|
||||
#include "SDL.h"
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "CommonDefines.h"
|
||||
#include "Tags.h"
|
||||
#include "Types.h"
|
||||
|
||||
#define JOYSTICK_DEADZONE 10000
|
||||
|
||||
SDL_Joystick *joystick; // This was probably a name that was given by Simon, but it fits the rest of Pixel's names so it's fine.
|
||||
|
@ -26,7 +22,7 @@ void ReleaseDirectInput()
|
|||
}
|
||||
}
|
||||
|
||||
bool InitDirectInput()
|
||||
BOOL InitDirectInput()
|
||||
{
|
||||
// Open first available joystick
|
||||
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
|
||||
|
@ -40,10 +36,10 @@ bool InitDirectInput()
|
|||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool GetJoystickStatus(JOYSTICK_STATUS *pStatus)
|
||||
BOOL GetJoystickStatus(JOYSTICK_STATUS *pStatus)
|
||||
{
|
||||
// Clear status
|
||||
memset(pStatus, 0, sizeof(JOYSTICK_STATUS));
|
||||
|
@ -64,13 +60,13 @@ bool GetJoystickStatus(JOYSTICK_STATUS *pStatus)
|
|||
for (int button = 0; button < numButtons; button++)
|
||||
pStatus->bButton[button] = SDL_JoystickGetButton(joystick, button) != 0;
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool ResetJoystickStatus()
|
||||
BOOL ResetJoystickStatus()
|
||||
{
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
20
src/Input.h
20
src/Input.h
|
@ -1,18 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
extern bool gbUseJoystick;
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
extern BOOL gbUseJoystick;
|
||||
extern int gJoystickButtonTable[8];
|
||||
|
||||
struct JOYSTICK_STATUS
|
||||
{
|
||||
bool bLeft;
|
||||
bool bRight;
|
||||
bool bUp;
|
||||
bool bDown;
|
||||
bool bButton[32];
|
||||
BOOL bLeft;
|
||||
BOOL bRight;
|
||||
BOOL bUp;
|
||||
BOOL bDown;
|
||||
BOOL bButton[32];
|
||||
};
|
||||
|
||||
void ReleaseDirectInput();
|
||||
bool InitDirectInput();
|
||||
bool GetJoystickStatus(JOYSTICK_STATUS *pStatus);
|
||||
bool ResetJoystickStatus();
|
||||
BOOL InitDirectInput();
|
||||
BOOL GetJoystickStatus(JOYSTICK_STATUS *pStatus);
|
||||
BOOL ResetJoystickStatus();
|
||||
|
|
39
src/Main.cpp
39
src/Main.cpp
|
@ -4,7 +4,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <SDL.h>
|
||||
#include "SDL.h"
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
|||
#include "Resource.h"
|
||||
#include "Sound.h"
|
||||
#include "Triangle.h"
|
||||
#include "Types.h"
|
||||
|
||||
// These two are defined in Draw.cpp. This is a bit of a hack.
|
||||
extern SDL_Window *gWindow;
|
||||
|
@ -33,10 +32,10 @@ char gDataPath[PATH_LENGTH];
|
|||
int gJoystickButtonTable[8];
|
||||
|
||||
int ghWnd; // Placeholder until we restore the WinAPI code
|
||||
bool gbUseJoystick = false;
|
||||
bool bFps = false;
|
||||
BOOL gbUseJoystick = FALSE;
|
||||
BOOL bFps = FALSE;
|
||||
|
||||
bool bActive = true;
|
||||
BOOL bActive = TRUE;
|
||||
|
||||
#ifdef JAPANESE
|
||||
const char *lpWindowName = "洞窟物語エンジン2";
|
||||
|
@ -68,7 +67,7 @@ void PutFramePerSecound()
|
|||
int GetFramePerSecound()
|
||||
{
|
||||
unsigned int current_tick;
|
||||
static bool need_new_base_tick = true;
|
||||
static BOOL need_new_base_tick = TRUE;
|
||||
static int frames_this_second;
|
||||
static int current_frame;
|
||||
static int base_tick;
|
||||
|
@ -76,7 +75,7 @@ int GetFramePerSecound()
|
|||
if (need_new_base_tick)
|
||||
{
|
||||
base_tick = SDL_GetTicks();
|
||||
need_new_base_tick = false;
|
||||
need_new_base_tick = FALSE;
|
||||
}
|
||||
|
||||
current_tick = SDL_GetTicks();
|
||||
|
@ -299,7 +298,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
StartDirectDraw(2, colourDepth);
|
||||
|
||||
fullscreen = true;
|
||||
fullscreen = TRUE;
|
||||
SDL_ShowCursor(0);
|
||||
break;
|
||||
}
|
||||
|
@ -313,7 +312,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
// Check debug things
|
||||
if (CheckFileExists("fps"))
|
||||
bFps = true;
|
||||
bFps = TRUE;
|
||||
|
||||
#ifndef WINDOWS
|
||||
// Load icon
|
||||
|
@ -359,7 +358,7 @@ int main(int argc, char *argv[])
|
|||
if (config.bJoystick && InitDirectInput())
|
||||
{
|
||||
ResetJoystickStatus();
|
||||
gbUseJoystick = true;
|
||||
gbUseJoystick = TRUE;
|
||||
}
|
||||
|
||||
// Initialize stuff
|
||||
|
@ -390,7 +389,7 @@ void InactiveWindow()
|
|||
{
|
||||
if (bActive)
|
||||
{
|
||||
bActive = false;
|
||||
bActive = FALSE;
|
||||
StopOrganyaMusic();
|
||||
SleepNoise();
|
||||
}
|
||||
|
@ -402,7 +401,7 @@ void ActiveWindow()
|
|||
{
|
||||
if (!bActive)
|
||||
{
|
||||
bActive = true;
|
||||
bActive = TRUE;
|
||||
StopOrganyaMusic();
|
||||
PlayOrganyaMusic();
|
||||
ResetNoise();
|
||||
|
@ -446,10 +445,10 @@ void JoystickProc()
|
|||
gKey &= ~key; \
|
||||
break;
|
||||
|
||||
bool SystemTask()
|
||||
BOOL SystemTask()
|
||||
{
|
||||
// Handle window events
|
||||
bool focusGained = true;
|
||||
BOOL focusGained = TRUE;
|
||||
|
||||
while (SDL_PollEvent(NULL) || !focusGained)
|
||||
{
|
||||
|
@ -459,19 +458,19 @@ bool SystemTask()
|
|||
switch (event.type)
|
||||
{
|
||||
case SDL_QUIT:
|
||||
return false;
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case SDL_WINDOWEVENT:
|
||||
switch (event.window.event)
|
||||
{
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
focusGained = true;
|
||||
focusGained = TRUE;
|
||||
ActiveWindow();
|
||||
break;
|
||||
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
focusGained = false;
|
||||
focusGained = FALSE;
|
||||
InactiveWindow();
|
||||
break;
|
||||
|
||||
|
@ -552,7 +551,7 @@ bool SystemTask()
|
|||
DO_KEY_PRESS(KEY_PLUS)
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
gbUseJoystick = false;
|
||||
gbUseJoystick = FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -621,7 +620,7 @@ bool SystemTask()
|
|||
DO_KEY_PRESS(KEY_PLUS)
|
||||
|
||||
case SDLK_F5:
|
||||
gbUseJoystick = false;
|
||||
gbUseJoystick = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -633,5 +632,5 @@ bool SystemTask()
|
|||
if (gbUseJoystick)
|
||||
JoystickProc();
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "Map.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "CommonDefines.h"
|
||||
#include "Draw.h"
|
||||
#include "Escape.h"
|
||||
#include "Game.h"
|
||||
#include "KeyControl.h"
|
||||
#include "Main.h"
|
||||
#include "Map.h"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "MycParam.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Caret.h"
|
||||
#include "Game.h"
|
||||
#include "Frame.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Caret.h"
|
||||
#include "CommonDefines.h"
|
||||
#include "Game.h"
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "CommonDefines.h"
|
||||
#include "Draw.h"
|
||||
#include "Flash.h"
|
||||
#include "Frame.h"
|
||||
#include "Game.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
#include "Frame.h"
|
||||
|
@ -10,7 +9,6 @@
|
|||
#include "MyChar.h"
|
||||
#include "NpChar.h"
|
||||
#include "Sound.h"
|
||||
#include "Triangle.h"
|
||||
|
||||
// Grate
|
||||
void ActNpc100(NPCHAR *npc)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
#include "Frame.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
#include "CommonDefines.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Caret.h"
|
||||
#include "CommonDefines.h"
|
||||
#include "Frame.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
#include "Frame.h"
|
||||
|
|
|
@ -2,10 +2,7 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
#include "Frame.h"
|
||||
#include "Game.h"
|
||||
#include "MyChar.h"
|
||||
#include "NpChar.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Caret.h"
|
||||
#include "Frame.h"
|
||||
#include "Game.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Caret.h"
|
||||
#include "Frame.h"
|
||||
#include "Game.h"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Boss.h"
|
||||
#include "Frame.h"
|
||||
#include "Game.h"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Boss.h"
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "NpcAct.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
#include "Frame.h"
|
||||
|
@ -12,7 +13,6 @@
|
|||
#include "MyChar.h"
|
||||
#include "NpChar.h"
|
||||
#include "Sound.h"
|
||||
#include "Triangle.h"
|
||||
|
||||
// Curly (carried, shooting)
|
||||
void ActNpc320(NPCHAR *npc)
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Back.h"
|
||||
#include "Caret.h"
|
||||
#include "CommonDefines.h"
|
||||
#include "Draw.h"
|
||||
#include "Flash.h"
|
||||
#include "Flags.h"
|
||||
#include "Frame.h"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Draw.h"
|
||||
#include "NpChar.h"
|
||||
|
||||
struct NPC_TBL_RECT
|
||||
|
|
|
@ -4,16 +4,12 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <SDL_thread.h>
|
||||
#include <SDL_timer.h>
|
||||
#include <SDL_events.h>
|
||||
#include "SDL.h"
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "CommonDefines.h"
|
||||
#include "Resource.h"
|
||||
#include "Sound.h"
|
||||
#include "Tags.h"
|
||||
|
||||
#define PANDUMMY 0xFF
|
||||
#define VOLDUMMY 0xFF
|
||||
|
@ -30,9 +26,9 @@ MUSICINFO info;
|
|||
|
||||
int gTrackVol[MAXTRACK];
|
||||
int gOrgVolume = 100;
|
||||
bool bFadeout = false;
|
||||
BOOL bFadeout = FALSE;
|
||||
|
||||
bool OrganyaNoteAlloc(unsigned short alloc)
|
||||
BOOL OrganyaNoteAlloc(unsigned short alloc)
|
||||
{
|
||||
for(int j = 0; j < MAXTRACK; j++)
|
||||
{
|
||||
|
@ -51,7 +47,7 @@ bool OrganyaNoteAlloc(unsigned short alloc)
|
|||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for(int i = 0; i < alloc; i++)
|
||||
|
@ -72,7 +68,7 @@ bool OrganyaNoteAlloc(unsigned short alloc)
|
|||
|
||||
//this->track = 0;
|
||||
|
||||
return true;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void OrganyaReleaseNote()
|
||||
|
@ -109,7 +105,7 @@ OCTWAVE oct_wave[8] = {
|
|||
{ 8,128, 32 }, //7 Oct
|
||||
};
|
||||
|
||||
bool MakeSoundObject8(signed char *wavep, signed char track, signed char pipi)
|
||||
BOOL MakeSoundObject8(signed char *wavep, signed char track, signed char pipi)
|
||||
{
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
|
@ -150,7 +146,7 @@ bool MakeSoundObject8(signed char *wavep, signed char track, signed char pipi)
|
|||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//Playing melody tracks
|
||||
|
@ -272,17 +268,17 @@ BOOL InitWaveData100()
|
|||
}
|
||||
|
||||
//Create org wave
|
||||
bool MakeOrganyaWave(signed char track, signed char wave_no, signed char pipi)
|
||||
BOOL MakeOrganyaWave(signed char track, signed char wave_no, signed char pipi)
|
||||
{
|
||||
if(wave_no > 99)
|
||||
{
|
||||
printf("WARNING: track %d has out-of-range wave_no %d\n", track, wave_no);
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ReleaseOrganyaObject(track);
|
||||
MakeSoundObject8(wave_data[wave_no], track, pipi);
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//Dram
|
||||
|
@ -525,14 +521,14 @@ void LoadOrganya(const char *name)
|
|||
SetPlayPointer(0);
|
||||
|
||||
//Set as loaded
|
||||
info.loaded = true;
|
||||
info.loaded = TRUE;
|
||||
}
|
||||
|
||||
void SetOrganyaPosition(unsigned int x)
|
||||
{
|
||||
SetPlayPointer(x);
|
||||
gOrgVolume = 100;
|
||||
bFadeout = false;
|
||||
bFadeout = FALSE;
|
||||
}
|
||||
|
||||
unsigned int GetOrganyaPosition()
|
||||
|
@ -546,15 +542,15 @@ void PlayOrganyaMusic()
|
|||
OrganyaStartTimer(info.wait);
|
||||
}
|
||||
|
||||
bool ChangeOrganyaVolume(signed int volume)
|
||||
BOOL ChangeOrganyaVolume(signed int volume)
|
||||
{
|
||||
if (volume >= 0 && volume <= 100)
|
||||
{
|
||||
gOrgVolume = volume;
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void StopOrganyaMusic()
|
||||
|
@ -573,12 +569,12 @@ void StopOrganyaMusic()
|
|||
|
||||
void SetOrganyaFadeout()
|
||||
{
|
||||
bFadeout = true;
|
||||
bFadeout = TRUE;
|
||||
}
|
||||
|
||||
//Org timer
|
||||
SDL_Thread *OrganyaTimer = NULL;
|
||||
bool bEndTimer = false;
|
||||
BOOL bEndTimer = FALSE;
|
||||
|
||||
int OrganyaPlayTimer(void *ptr)
|
||||
{
|
||||
|
@ -587,7 +583,7 @@ int OrganyaPlayTimer(void *ptr)
|
|||
//Set time for next step to play
|
||||
Uint32 NextTick = SDL_GetTicks() + info.wait;
|
||||
|
||||
while (bEndTimer == false)
|
||||
while (bEndTimer == FALSE)
|
||||
{
|
||||
if (info.loaded)
|
||||
{
|
||||
|
@ -615,13 +611,13 @@ int OrganyaPlayTimer(void *ptr)
|
|||
void OrganyaStartTimer(unsigned int wait)
|
||||
{
|
||||
OrganyaEndTimer();
|
||||
bEndTimer = false;
|
||||
bEndTimer = FALSE;
|
||||
OrganyaTimer = SDL_CreateThread(OrganyaPlayTimer, "OrganyaPlayTimer", (void*)NULL);
|
||||
}
|
||||
|
||||
void OrganyaEndTimer()
|
||||
{
|
||||
bEndTimer = true; //Tell thread to end
|
||||
bEndTimer = TRUE; //Tell thread to end
|
||||
SDL_WaitThread(OrganyaTimer, NULL); //Wait for thread to end
|
||||
OrganyaTimer = NULL;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
//Below are Organya song data structures
|
||||
struct NOTELIST {
|
||||
NOTELIST *from; //Previous address
|
||||
|
@ -26,8 +28,8 @@ struct TRACKDATA {
|
|||
//Unique information held in songs
|
||||
struct MUSICINFO {
|
||||
unsigned short wait;
|
||||
bool loaded;
|
||||
bool playing;
|
||||
BOOL loaded;
|
||||
BOOL playing;
|
||||
unsigned char line; //Number of lines in one measure
|
||||
unsigned char dot; //Number of dots per line
|
||||
unsigned short alloc_note; //Number of allocated notes
|
||||
|
@ -36,14 +38,14 @@ struct MUSICINFO {
|
|||
TRACKDATA tdata[16];
|
||||
};
|
||||
|
||||
bool MakeOrganyaWave(signed char track, signed char wave_no, signed char pipi);
|
||||
BOOL MakeOrganyaWave(signed char track, signed char wave_no, signed char pipi);
|
||||
void OrganyaPlayData();
|
||||
void SetPlayPointer(long x);
|
||||
void LoadOrganya(const char *name);
|
||||
void SetOrganyaPosition(unsigned int x);
|
||||
unsigned int GetOrganyaPosition();
|
||||
void PlayOrganyaMusic();
|
||||
bool ChangeOrganyaVolume(signed int volume);
|
||||
BOOL ChangeOrganyaVolume(signed int volume);
|
||||
void StopOrganyaMusic();
|
||||
void SetOrganyaFadeout();
|
||||
void OrganyaStartTimer(unsigned int wait);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "PixTone.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "CommonDefines.h"
|
||||
#include "Draw.h"
|
||||
#include "Escape.h"
|
||||
#include "KeyControl.h"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "Shoot.h"
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "ArmsItem.h"
|
||||
#include "Bullet.h"
|
||||
#include "Caret.h"
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#include "Sound.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <SDL.h>
|
||||
#include "SDL.h"
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Organya.h"
|
||||
#include "PixTone.h"
|
||||
|
@ -14,9 +15,9 @@
|
|||
#define FREQUENCY 44100
|
||||
|
||||
#ifdef RASPBERRY_PI
|
||||
#define STREAM_SIZE 0x400
|
||||
#define STREAM_SIZE 0x400 // Larger buffer to prevent stutter
|
||||
#else
|
||||
#define STREAM_SIZE (FREQUENCY / 200)
|
||||
#define STREAM_SIZE 0x100 // FREQUENCY/200 rounded to the nearest power of 2 (SDL2 *needs* a power-of-2 buffer size)
|
||||
#endif
|
||||
|
||||
#define clamp(x, y, z) (((x) > (z)) ? (z) : ((x) < (y)) ? (y) : (x))
|
||||
|
@ -219,7 +220,7 @@ void AudioCallback(void *userdata, Uint8 *stream, int len)
|
|||
//Sound things
|
||||
SOUNDBUFFER* lpSECONDARYBUFFER[SOUND_NO];
|
||||
|
||||
bool InitDirectSound()
|
||||
BOOL InitDirectSound()
|
||||
{
|
||||
//Init sound
|
||||
SDL_InitSubSystem(SDL_INIT_AUDIO);
|
||||
|
@ -240,7 +241,7 @@ bool InitDirectSound()
|
|||
if (audioDevice == 0)
|
||||
{
|
||||
printf("Failed to open audio device\nSDL Error: %s\n", SDL_GetError());
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//Unpause audio device
|
||||
|
@ -248,7 +249,7 @@ bool InitDirectSound()
|
|||
|
||||
//Start organya
|
||||
StartOrganya();
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void EndDirectSound()
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "PixTone.h"
|
||||
|
||||
class SOUNDBUFFER
|
||||
|
@ -91,7 +93,7 @@ enum MUSIC_IDS
|
|||
#define SOUND_NO 0x100
|
||||
extern SOUNDBUFFER* lpSECONDARYBUFFER[SOUND_NO];
|
||||
|
||||
bool InitDirectSound();
|
||||
BOOL InitDirectSound();
|
||||
void EndDirectSound();
|
||||
void PlaySoundObject(int no, int mode);
|
||||
void ChangeSoundFrequency(int no, unsigned long rate);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "MyChar.h"
|
||||
#include "NpChar.h"
|
||||
#include "Organya.h"
|
||||
#include "Tags.h"
|
||||
#include "TextScr.h"
|
||||
#include "ValueView.h"
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "WindowsWrapper.h"
|
||||
|
||||
#include "Draw.h"
|
||||
#include "Game.h"
|
||||
#include "ValueView.h"
|
||||
|
||||
#define VALUEVIEW_MAX 0x10
|
||||
|
|
|
@ -35,4 +35,4 @@ struct RECT
|
|||
int bottom;
|
||||
};
|
||||
|
||||
bool SystemTask();
|
||||
BOOL SystemTask();
|
||||
|
|
Loading…
Add table
Reference in a new issue