aboutsummaryrefslogtreecommitdiff
path: root/modules/chibi/cp_loader_it_patterns.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2017-03-19 00:36:26 +0100
committerRémi Verschelde2017-03-19 00:36:26 +0100
commitf8db8a3faa30b71dca33ced38be16d3f93f43e8a (patch)
tree3b798318132cca7eccfbca5818ab55656a2896d7 /modules/chibi/cp_loader_it_patterns.cpp
parent1d418afe863c9e553b69174ce63aef203c46d2f0 (diff)
downloadgodot-f8db8a3faa30b71dca33ced38be16d3f93f43e8a.tar.gz
godot-f8db8a3faa30b71dca33ced38be16d3f93f43e8a.tar.zst
godot-f8db8a3faa30b71dca33ced38be16d3f93f43e8a.zip
Bring that Whole New World to the Old Continent too
Applies the clang-format style to the 2.1 branch as done for master in 5dbf1809c6e3e905b94b8764e99491e608122261.
Diffstat (limited to 'modules/chibi/cp_loader_it_patterns.cpp')
-rw-r--r--modules/chibi/cp_loader_it_patterns.cpp137
1 files changed, 65 insertions, 72 deletions
diff --git a/modules/chibi/cp_loader_it_patterns.cpp b/modules/chibi/cp_loader_it_patterns.cpp
index 528d99fff..156e49742 100644
--- a/modules/chibi/cp_loader_it_patterns.cpp
+++ b/modules/chibi/cp_loader_it_patterns.cpp
@@ -28,139 +28,132 @@
/*************************************************************************/
#include "cp_loader_it.h"
-
CPLoader::Error CPLoader_IT::load_patterns() {
+ for (int i = 0; i < header.patnum; i++) {
- for (int i=0;i<header.patnum;i++) {
-
- if (i>=CPSong::MAX_PATTERNS)
+ if (i >= CPSong::MAX_PATTERNS)
break;
-
+
/* Position where pattern offsets are stored */
- file->seek(0xC0+header.ordnum+header.insnum*4+header.smpnum*4+i*4);
- uint32_t pattern_offset=file->get_dword();
-
- if (pattern_offset==0) {
+ file->seek(0xC0 + header.ordnum + header.insnum * 4 + header.smpnum * 4 + i * 4);
+ uint32_t pattern_offset = file->get_dword();
+
+ if (pattern_offset == 0) {
continue;
}
-
+
uint16_t pat_size;
uint16_t pat_length;
- int row=0,flag,channel,j;
+ int row = 0, flag, channel, j;
uint8_t aux_byte;
uint32_t reserved;
uint8_t chan_mask[64]; //mask cache for each
CPNote last_value[64]; //last value of each
- for (j=0;j<64;j++) {
+ for (j = 0; j < 64; j++) {
- chan_mask[j]=0;
+ chan_mask[j] = 0;
last_value[j].clear();
}
file->seek(pattern_offset);
- pat_size=file->get_word();
- pat_length=file->get_word();
- reserved=file->get_dword();
+ pat_size = file->get_word();
+ pat_length = file->get_word();
+ reserved = file->get_dword();
+
+ song->get_pattern(i)->set_length(pat_length);
- song->get_pattern(i)->set_length( pat_length );
-
do {
- aux_byte=file->get_byte();
- flag=aux_byte;
+ aux_byte = file->get_byte();
+ flag = aux_byte;
- if ( flag==0 ) {
+ if (flag == 0) {
row++;
} else {
- channel=(flag-1) & 63;
+ channel = (flag - 1) & 63;
- if ( flag & 128 ) {
+ if (flag & 128) {
- aux_byte=file->get_byte();
- chan_mask[channel]=aux_byte;
+ aux_byte = file->get_byte();
+ chan_mask[channel] = aux_byte;
}
CPNote note; //note used for reading
- if ( chan_mask[channel]&1 ) { // read note
-
- aux_byte=file->get_byte();
-
- if ( aux_byte<120 )
- note.note=aux_byte;
- else if ( aux_byte==255 )
- note.note=CPNote::OFF;
- else if ( aux_byte==254 )
- note.note=CPNote::CUT;
+ if (chan_mask[channel] & 1) { // read note
- last_value[channel].note=note.note;
+ aux_byte = file->get_byte();
+
+ if (aux_byte < 120)
+ note.note = aux_byte;
+ else if (aux_byte == 255)
+ note.note = CPNote::OFF;
+ else if (aux_byte == 254)
+ note.note = CPNote::CUT;
+
+ last_value[channel].note = note.note;
}
-
- if ( chan_mask[channel]&2 ) {
+ if (chan_mask[channel] & 2) {
- aux_byte=file->get_byte();
- if ( aux_byte<100 )
- note.instrument=aux_byte-1;
+ aux_byte = file->get_byte();
+ if (aux_byte < 100)
+ note.instrument = aux_byte - 1;
- last_value[channel].instrument=note.instrument;
+ last_value[channel].instrument = note.instrument;
}
- if ( chan_mask[channel]&4 ) {
+ if (chan_mask[channel] & 4) {
- aux_byte=file->get_byte();
- if ( aux_byte<213 )
- note.volume=aux_byte;
+ aux_byte = file->get_byte();
+ if (aux_byte < 213)
+ note.volume = aux_byte;
- last_value[channel].volume=note.volume;
+ last_value[channel].volume = note.volume;
}
- if ( chan_mask[channel]&8 ) {
+ if (chan_mask[channel] & 8) {
+
+ aux_byte = file->get_byte();
+ if (aux_byte > 0)
+ note.command = aux_byte - 1;
- aux_byte=file->get_byte();
- if ( aux_byte>0 )
- note.command=aux_byte-1;
-
-
- last_value[channel].command=note.command;
+ last_value[channel].command = note.command;
- note.parameter=file->get_byte();
-
- last_value[channel].parameter=note.parameter;
+ note.parameter = file->get_byte();
+
+ last_value[channel].parameter = note.parameter;
}
- if ( chan_mask[channel]&16 ) {
+ if (chan_mask[channel] & 16) {
- note.note=last_value[channel].note;
+ note.note = last_value[channel].note;
}
- if ( chan_mask[channel]&32 ) {
+ if (chan_mask[channel] & 32) {
- note.instrument=last_value[channel].instrument;
+ note.instrument = last_value[channel].instrument;
}
- if ( chan_mask[channel]&64 ) {
+ if (chan_mask[channel] & 64) {
- note.volume=last_value[channel].volume;
+ note.volume = last_value[channel].volume;
}
- if ( chan_mask[channel]&128 ) {
+ if (chan_mask[channel] & 128) {
- note.command=last_value[channel].command;
- note.parameter=last_value[channel].parameter;
+ note.command = last_value[channel].command;
+ note.parameter = last_value[channel].parameter;
}
-
- song->get_pattern(i)->set_note(channel,row,note);
+
+ song->get_pattern(i)->set_note(channel, row, note);
}
-
-
- } while(row<pat_length);
+ } while (row < pat_length);
}
return FILE_OK;
}
-