projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bdbb5c9
)
changed loading of Supaplex demos to use function for adding action to tape
author
Holger Schemel
<info@artsoft.org>
Wed, 10 Jan 2018 11:06:06 +0000
(12:06 +0100)
committer
Holger Schemel
<info@artsoft.org>
Wed, 10 Jan 2018 11:06:06 +0000
(12:06 +0100)
src/files.c
patch
|
blob
|
history
src/tape.h
patch
|
blob
|
history
diff --git
a/src/files.c
b/src/files.c
index 1f07c4894bd51a5e387e5aa62eb1042b902d8814..7255cdc54533df9248bd1e7b16284375ff31eccf 100644
(file)
--- a/
src/files.c
+++ b/
src/files.c
@@
-3820,8
+3820,8
@@
static void CopyNativeTape_SP_to_RND(struct LevelInfo *level)
TapeSetDateFromEpochSeconds(getFileTimestampEpochSeconds(filename));
TapeSetDateFromEpochSeconds(getFileTimestampEpochSeconds(filename));
- tape.
length
= 0;
- tape.pos[tape.
length
].delay = 0;
+ tape.
counter
= 0;
+ tape.pos[tape.
counter
].delay = 0;
for (i = 0; i < demo->length; i++)
{
for (i = 0; i < demo->length; i++)
{
@@
-3829,41
+3829,23
@@
static void CopyNativeTape_SP_to_RND(struct LevelInfo *level)
int demo_repeat = (demo->data[i] & 0xf0) >> 4;
int tape_action = map_key_SP_to_RND(demo_action);
int tape_repeat = demo_repeat + 1;
int demo_repeat = (demo->data[i] & 0xf0) >> 4;
int tape_action = map_key_SP_to_RND(demo_action);
int tape_repeat = demo_repeat + 1;
- int tape_entries = 1; // one new tape entry may be added
+ byte action[MAX_PLAYERS] = { tape_action, 0, 0, 0 };
+ boolean success;
+ int j;
+
+ for (j = 0; j < tape_repeat; j++)
+ success = TapeAddAction(action);
- if (
tape.length + tape_entries >= MAX_TAPE_LEN
)
+ if (
!success
)
{
Error(ERR_WARN, "SP demo truncated: size exceeds maximum tape size %d",
MAX_TAPE_LEN);
break;
}
{
Error(ERR_WARN, "SP demo truncated: size exceeds maximum tape size %d",
MAX_TAPE_LEN);
break;
}
-
- if (tape.pos[tape.length].delay > 0) /* already stored action */
- {
- if (tape.pos[tape.length].action[0] != tape_action ||
- tape.pos[tape.length].delay + tape_repeat >= 256)
- {
- tape.length++;
- tape.pos[tape.length].delay = 0;
- }
- else
- {
- tape.pos[tape.length].delay += tape_repeat;
- }
- }
-
- if (tape.pos[tape.length].delay == 0) /* store new action */
- {
- tape.pos[tape.length].action[0] = tape_action;
- tape.pos[tape.length].delay = tape_repeat;
- }
}
}
- tape.length++;
-
- tape.length_frames = GetTapeLengthFrames();
- tape.length_seconds = GetTapeLengthSeconds();
+ TapeHaltRecording();
}
}
diff --git
a/src/tape.h
b/src/tape.h
index bc80f440b3ec191dd6f911caf1d1e01674fedd27..f4d19043409cf0c85c518be6e47f7488b8581411 100644
(file)
--- a/
src/tape.h
+++ b/
src/tape.h
@@
-211,6
+211,7
@@
void TapeSetDateFromNow();
void TapeStartRecording(int);
void TapeHaltRecording(void);
void TapeStopRecording(void);
void TapeStartRecording(int);
void TapeHaltRecording(void);
void TapeStopRecording(void);
+boolean TapeAddAction(byte *);
void TapeRecordAction(byte *);
void TapeTogglePause(boolean);
void TapeStartPlaying(void);
void TapeRecordAction(byte *);
void TapeTogglePause(boolean);
void TapeStartPlaying(void);