Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/alekmaul/pvsneslib into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
alekmaul committed Nov 23, 2023
2 parents 42b2db8 + e36af09 commit 7594f0f
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 25 deletions.
2 changes: 2 additions & 0 deletions pvsneslib/source/maps.asm
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ mapGetMetaTile:
rep #$20
lda 0,x
plb
and #$03FF ; to have only tile number (no flipx/y)
plx

sta.w tcc__r0
Expand Down Expand Up @@ -1003,6 +1004,7 @@ mapGetMetaTilesProp:
rep #$20
lda 0,x
plb
and #$03FF ; to have only tile number (no flipx/y)
plx

asl a ; property is a 16bit arrays
Expand Down
2 changes: 1 addition & 1 deletion snes-examples/logo/snes-logo-capcom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include ${PVSNESLIB_HOME}/devkitsnes/snes_rules

#---------------------------------------------------------------------------------
# ROMNAME is used in snes_rules file
export ROMNAME := logo
export ROMNAME := LogoCapcom

# to build musics, define SMCONVFLAGS with parameters you want
SMCONVFLAGS := -s -o $(SOUNDBANK) -V -b 5
Expand Down
79 changes: 57 additions & 22 deletions snes-examples/logo/snes-logo-capcom/src/logo.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,17 @@ void initCapcomLogo() {
*/
REG_CGADSUB = 0b10111111;

/* Color Math Sub Screen Backdrop Color (W)
This 8bit port allows to manipulate some (or all) bits
of a 15bit RGB value.
Examples:
- Black: write E0h (R,G,B=0)
- Cyan: write 20h (R=0) and DFh (G,B=1Fh)
7 Apply Blue (0=No change, 1=Apply Intensity as Blue)
6 Apply Green (0=No change, 1=Apply Intensity as Green)
5 Apply Red (0=No change, 1=Apply Intensity as Red)
4-0 Intensity (0..31)
*/
REG_COLDATA = appliedColor | colorIntensity;

// Load logo on BG1
Expand Down Expand Up @@ -340,6 +351,46 @@ void initCapcomLogo() {
bgSetDisable(BG3);
}

/*!\brief Fade in with REG_COLDATA.
\return 1 when fade in is complete or 0 otherwise.
*/
u8 colorMathFadeIn() {
if (colorIntensity == 0) {
return 1;
}

if (colorIntensity > 0 && intensityState == 4) {
colorIntensity -= 1;
REG_COLDATA = appliedColor | colorIntensity;
intensityState = 0;

} else {
intensityState += 1;
}

return 0;
}

/*!\brief Fade out with REG_COLDATA.
\return 1 when fade out is complete or 0 otherwise.
*/
u8 colorMathFadeOut() {
if (colorIntensity == 31) {
return 1;
}

if (colorIntensity < 31 && intensityState == 3) {
colorIntensity += 1;
REG_COLDATA = appliedColor | colorIntensity;
intensityState = 0;

} else {
intensityState += 1;
}

return 0;
}

/*!\brief Update the Capcom logo animation.
\return 1 when the logo animation is complete, 0 otherwise.
*/
Expand Down Expand Up @@ -369,34 +420,18 @@ u8 updateCapcomLogo() {
break;
}

// Fade in
if (colorIntensity >= 0 && intensityState == 4) {
/* Color Math Sub Screen Backdrop Color (W)
This 8bit port allows to manipulate some (or all) bits
of a 15bit RGB value.
Examples:
- Black: write E0h (R,G,B=0)
- Cyan: write 20h (R=0) and DFh (G,B=1Fh)
7 Apply Blue (0=No change, 1=Apply Intensity as Blue)
6 Apply Green (0=No change, 1=Apply Intensity as Green)
5 Apply Red (0=No change, 1=Apply Intensity as Red)
4-0 Intensity (0..31)
*/
REG_COLDATA = appliedColor | colorIntensity;
colorIntensity -= 1;
intensityState = 0;
if (framesCounter < 200) {
colorMathFadeIn();

} else {
intensityState += 1;
}

if (framesCounter == 200) {
} else if (framesCounter == 200) {
spcStop();

} else if (framesCounter == 201) {
// Note: process spcStop() properly.
spcProcess();
return 1;

} else if (framesCounter > 201) {
return colorMathFadeOut();

} else {
spcProcess();
Expand Down
2 changes: 1 addition & 1 deletion snes-examples/logo/snes-logo-konami/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include ${PVSNESLIB_HOME}/devkitsnes/snes_rules

#---------------------------------------------------------------------------------
# ROMNAME is used in snes_rules file
export ROMNAME := logo
export ROMNAME := LogoKonami

# to build musics, define SMCONVFLAGS with parameters you want
SMCONVFLAGS := -s -o $(SOUNDBANK) -V -b 5
Expand Down
2 changes: 1 addition & 1 deletion snes-examples/logo/snes-logo-pvsneslib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include ${PVSNESLIB_HOME}/devkitsnes/snes_rules

#---------------------------------------------------------------------------------
# ROMNAME is used in snes_rules file
export ROMNAME := logo
export ROMNAME := LogoPVSnesLib

# to build musics, define SMCONVFLAGS with parameters you want
SMCONVFLAGS := -s -o $(SOUNDBANK) -V -b 5
Expand Down

0 comments on commit 7594f0f

Please sign in to comment.