Added latests changes.

This commit is contained in:
SaffronCR
2019-11-24 13:02:53 +01:00
parent 2708b0307a
commit 135b47fffc
11 changed files with 482 additions and 39 deletions

63
.gitattributes vendored Normal file
View File

@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

261
.gitignore vendored Normal file
View File

@@ -0,0 +1,261 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

View File

@@ -34,6 +34,12 @@ It's being created in GRAPHIC 4, SCREEN 5 mode (resolution: 256 x 212 pixels, 16
http://www.repro-factory.com/
**Palette based on DB16 - DawnBringer's 16 Col Palette v1.0**
*Author: DawnBringer*
http://pixeljoint.com/forum/forum_posts.asp?TID=12795
**First Person Dungeon Crawl Art Pack**
*Author: Clint Bellanger*

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

23
art_links.txt Normal file
View File

@@ -0,0 +1,23 @@
Arkos Tracker is the ultimate musical tool (or “Tracker”) for 8/16-bit computers from the 80s, such as Amstrad CPC, Atari ST, ZX Spectrum, MSX, Oric, Apple 2, Vectrex, and SHARP MZ-700!
http://www.julien-nevo.com/arkostracker/
https://opengameart.org/content/scifi-creature-tileset-mini-32x32-scifi-creature-icons
https://opengameart.org/content/first-person-dungeon-crawl-art-pack
https://opengameart.org/content/more-rpg-enemies
https://opengameart.org/content/cyberpunk-street-environment
MEGAFLASHROM
https://blog.falvarez.es/2013/03/tutorial-megaflashrom-scc-sd.html
MSX2-Technical-Handbook
https://github.com/Konamiman/MSX2-Technical-Handbook/blob/master/md/Chapter4a.md#3--screen-modes-of-the-msx2
Women's portrait studies no.57, MSX palette // Justin Cyr #MSX #pixelart #retro
https://www.pinterest.es/pin/294774738094668751/?lp=true
https://www.msx.org/news/en/500-womens-portrait-studies-in-msx-palette-by-justin-cyr
| * GRAPHIC 4 | SCREEN 5 | 256 x 212; 16 colours are |
| | | available for each dot

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
generate_sf5.bat Normal file
View File

@@ -0,0 +1,3 @@
@echo off
img2sf5 ./art/bg.png ./dsk/bg.sf5
img2sf5 ./art/walls.png ./dsk/walls.sf5

165
msx-rpg.c
View File

@@ -28,8 +28,8 @@
#define BG_PG 2
#define WL_PG 3
#define DUNGEON_SCREEN_X 48
#define DUNGEON_SCREEN_Y 36
#define DUNGEON_SCREEN_X 2 * 8
#define DUNGEON_SCREEN_Y 4 * 8
#define DUNGEON_SCREEN_DX 160
#define DUNGEON_SCREEN_DY 120
@@ -115,22 +115,22 @@ unsigned char load_buffer[BUFFER_SIZE];
unsigned char dungeon_palette[] =
{
0,0,0,0,
1,0,0,0,
2,0,0,0,
3,0,0,0,
4,0,0,0,
5,0,0,0,
6,0,0,0,
7,0,0,0,
8,0,0,0,
9,2,1,1,
10,1,1,3,
11,4,2,1,
12,6,2,2,
13,6,3,1,
14,4,4,5,
15,6,6,2
0, 0, 0, 0,
1, 2, 1, 1,
2, 1, 1, 3,
3, 2, 2, 2,
4, 4, 2, 1,
5, 1, 3, 1,
6, 6, 2, 2,
7, 3, 3, 3,
8, 2, 3, 6,
9, 6, 3, 1,
10, 4, 4, 4,
11, 3, 5, 1,
12, 6, 5, 4,
13, 6, 6, 3,
14, 1, 0, 1,
15, 6, 7, 6,
};
unsigned char dungeon_01[DUNGEON_SIZE*DUNGEON_SIZE] =
@@ -172,7 +172,7 @@ void sf_error_handler (char n, char *name)
{
InitPSG ();
Screen (0);
SetColors (15,6,6);
SetColors (15, 6, 6);
switch (n)
{
@@ -231,7 +231,7 @@ void sf_sc5_data (char *buffer, int y, int nbl)
}
// #TODO Check if the values are correct.
int sf_load_sc5_image (char *file_name, unsigned int start_Y, char *buffer)
int sf_load_sf5_image (char *file_name, unsigned int start_Y, char *buffer)
{
int rd = BUFFER_SIZE;
int nbl = 0;
@@ -246,11 +246,11 @@ int sf_load_sc5_image (char *file_name, unsigned int start_Y, char *buffer)
}
// Skip 7 first bytes of the file.
fcb_read (&file, buffer, 7);
//fcb_read (&file, buffer, 7);
while (rd != 0)
{
SetColors (0, 0, buffer[192]);
SetColors (15, 0, buffer[69]);
rd = fcb_read (&file, buffer, BUFFER_SIZE);
if (rd!=0)
@@ -258,7 +258,7 @@ int sf_load_sc5_image (char *file_name, unsigned int start_Y, char *buffer)
// screen 5 (4 bits x 256 x 212).
nbl = rd / 128;
SetColors (0, 0, 0);
SetColors (15, 0, 0);
//sf_sc5_data( buffer, start_Y, nbl);
@@ -565,12 +565,77 @@ void sf_update_dungeon ()
}
}
void sf_draw_tiles_background ()
{
// TEST: Draw tiles background.
for (int x=0; x<32; x++)
{
for (int y=0; y<26; y++)
{
sf_screen_copy (160, 0,
8, 8,
x*8, y*8,
BG_PG, BF_PG, opHMMM);
}
}
}
void sf_draw_avatars ()
{
sf_screen_copy ( 0, 120,
32, 32,
180, 1*32+4,
BG_PG, BF_PG, opHMMM);
sf_screen_copy (32, 120,
32, 32,
180, 2*32+4+8,
BG_PG, BF_PG, opHMMM);
sf_screen_copy (64, 120,
32, 32,
180, 3*32+4+8+8,
BG_PG, BF_PG, opHMMM);
}
void sf_draw_combat_menu ()
{
Rect ( 16, 159,
224, 167,
2, FILL_ALL);
SetColors (15, 0, 0);
PutText (20, 160, "ATTACK", LOGICAL_TIMP);
SetColors (8, 0, 0);
PutText (20, 160+9, "MAGIC", LOGICAL_IMP);
PutText (20, 160+9+9, "DEFEND", LOGICAL_IMP);
PutText (20, 160+9+9+9, "ITEMS", LOGICAL_IMP);
// HP bars
Rect (180+32+2, 1*32+4,
180+32+2+4, 1*32+4+32-1,
11, FILL_ALL);
Rect (180+32+2, 2*32+4+8,
180+32+2+4, 2*32+4+32+8-1,
11, FILL_ALL);
Rect (180+32+2, 3*32+4+8+8,
180+32+2+4, 3*32+4+32+8+8-1,
11, FILL_ALL);
}
// Draw the current dungeon room.
void sf_update_dungeon_screen ()
{
db_state = Updating;
// Background.
// #SAFFRON test.
sf_draw_avatars ();
// Dungeon background.
sf_screen_copy (0,0,
DUNGEON_SCREEN_DX, DUNGEON_SCREEN_DY,
DUNGEON_SCREEN_X, DUNGEON_SCREEN_Y,
@@ -586,6 +651,18 @@ void sf_update_dungeon_screen ()
db_state = ReadyToTransfer;
}
void sf_draw_palette ()
{
int x = 0;
int y = 0;
for (int i = 0; i < 16; i++)
{
Rect (x, y, x+7, y+7, i, FILL_ALL);
y+=9;
}
}
void sf_draw_minimap ()
{
for (int x = 0; x < DUNGEON_SIZE; x++)
@@ -594,11 +671,11 @@ void sf_draw_minimap ()
{
if (dungeon_01[x+y*DUNGEON_SIZE] == 1)
{
Pset (x, y, 10, LOGICAL_IMP);
Pset (x+32, y, 10, 0);
}
else if (player_pos_x == x && player_pos_y == y)
{
Pset (x, y, 11, LOGICAL_IMP);
Pset (x+32, y, 13, 0);
}
}
}
@@ -617,15 +694,21 @@ void sf_update_screen ()
BF_PG, 0, opYMMM);
// Using this to check screen redrawing. Actual game text will be handled differently.
SetColors (15, 0, 0);
SetColors (9, 0, 0);
if (player_dir == North) PutText (100, 20, "North", LOGICAL_IMP);
else if (player_dir == East) PutText (100, 20, "East", LOGICAL_IMP);
else if (player_dir == South) PutText (100, 20, "South", LOGICAL_IMP);
else PutText (100, 20, "West", LOGICAL_IMP);
if (player_dir == North) PutText (80, 20, "North", LOGICAL_IMP);
else if (player_dir == East) PutText (80, 20, "East", LOGICAL_IMP);
else if (player_dir == South) PutText (80, 20, "South", LOGICAL_IMP);
else PutText (80, 20, "West", LOGICAL_IMP);
// Minimap.
sf_draw_minimap ();
// #SAFFRON test.
sf_draw_combat_menu ();
// Debug: draw minimap.
//sf_draw_minimap ();
// Debug: draw palette.
//sf_draw_palette ();
db_state = Finished;
}
@@ -718,12 +801,12 @@ void main (void)
// Enables Sprites.
SpriteOn ();
// Sets display to specified screen mode (from 0 to 8).
Screen (5);
// Clears console or any screen mode
Cls ();
// Sets display to specified screen mode (from 0 to 8).
Screen (5);
// Disable key sound.
KeySound (0);
@@ -733,22 +816,26 @@ void main (void)
// Clears the key buffer.
KillKeyBuffer ();
// Set loading text.
SetColors (15, 0, 0);
PutText (5, 5, "LOADING...", LOGICAL_TIMP);
// Load screens.
SetSC5Palette ((Palette *)dungeon_palette);
sf_load_sc5_image ("BG.SC5", 256 * BG_PG, load_buffer);
sf_load_sc5_image ("WALLS.SC5", 256 * WL_PG, load_buffer);
sf_load_sf5_image ("BG.SF5", 256 * BG_PG, load_buffer);
sf_load_sf5_image ("WALLS.SF5", 256 * WL_PG, load_buffer);
// Clears console or any screen mode.
Cls ();
SetColors (0, 0, 0);
// Set interrupt.
InitInterruptHandler ();
SetInterruptHandler (sf_video_interrupt);
// Draw tiles from background.
//sf_draw_tiles_background ();
// Initial screen update.
sf_update_dungeon_screen ();