Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
caa91d0e
Commit
caa91d0e
authored
13 years ago
by
mcmlxxix
Browse files
Options
Downloads
Patches
Plain Diff
add support for *.ans files (minimally, no @ codes)
parent
0a08b4f3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/graphic.js
+101
-15
101 additions, 15 deletions
exec/load/graphic.js
with
101 additions
and
15 deletions
exec/load/graphic.js
+
101
−
15
View file @
caa91d0e
...
...
@@ -205,32 +205,118 @@ function Graphic_load(filename)
switch
(
file_type
.
toUpperCase
())
{
case
"
ANS
"
:
/*
if
(
!
(
f
.
open
(
"
r
"
,
true
,
4096
)))
return
(
false
);
var
lines
=
f
.
readAll
();
f
.
close
();
var cur_attr=this.attr;
var cur_ch=this.ch;
var ANSI=String.fromCharCode(27,91);
var
attr
=
this
.
attr
;
var
bg
=
BG_BLACK
;
var
fg
=
LIGHTGRAY
;
var
i
=
0
;
var
y
=
0
;
for(y=0; y<this.height && y<lines.length; y++) {
var x=0;
var index=0;
index=lines[y].indexOf(ANSI,index);
while(index >= 0) {
while
(
lines
.
length
>
0
)
{
var
x
=
0
;
var
line
=
lines
.
shift
();
}
txt=txt.toString().replace(/@(.*)@/g,
/* parse 'ATCODES'??
line = line.replace(/@(.*)@/g,
function (str, code, offset, s) {
return bbs.atcode(code);
}
)
this.data[x][y]=new Graphic_sector(cur_ch,cur_attr);
);
*/
while
(
line
.
length
>
0
)
{
/* parse an attribute sequence*/
var
m
=
line
.
match
(
/^
\x
1b
\[(\d
+
)
;
?(\d
*
)
;
?(\d
*
)
m/
);
if
(
m
!==
null
)
{
line
=
line
.
substr
(
m
.
shift
().
length
);
if
(
m
[
0
]
==
0
)
{
bg
=
BG_BLACK
;
fg
=
LIGHTGRAY
;
i
=
0
;
m
.
shift
();
}
if
(
m
[
0
]
==
1
)
{
i
=
HIGH
;
m
.
shift
();
}
if
(
m
[
0
]
>=
40
)
{
switch
(
Number
(
m
.
shift
()))
{
case
40
:
bg
=
BG_BLACK
;
break
;
case
41
:
bg
=
BG_RED
;
break
;
case
42
:
bg
=
BG_GREEN
;
break
;
case
43
:
bg
=
BG_BROWN
;
break
;
case
44
:
bg
=
BG_BLUE
;
break
;
case
45
:
bg
=
BG_MAGENTA
;
break
;
case
46
:
bg
=
BG_CYAN
;
break
;
case
47
:
bg
=
BG_LIGHTGRAY
;
break
;
}
}
if
(
m
[
0
]
>=
30
)
{
switch
(
Number
(
m
.
shift
()))
{
case
30
:
fg
=
BLACK
;
break
;
case
31
:
fg
=
RED
;
break
;
case
32
:
fg
=
GREEN
;
break
;
case
33
:
fg
=
BROWN
;
break
;
case
34
:
fg
=
BLUE
;
break
;
case
35
:
fg
=
MAGENTA
;
break
;
case
36
:
fg
=
CYAN
;
break
;
case
37
:
fg
=
LIGHTGRAY
;
break
;
}
}
attr
=
bg
+
fg
+
i
;
continue
;
}
/* parse a positional sequence */
var
n
=
line
.
match
(
/^
\x
1b
\[(\d
+
)
C/
);
if
(
n
!==
null
)
{
line
=
line
.
substr
(
n
.
shift
().
length
);
x
+=
Number
(
n
.
shift
());
continue
;
}
/* set character and attribute */
var
ch
=
line
[
0
];
line
=
line
.
substr
(
1
);
this
.
data
[
x
][
y
]
=
new
Graphic_sector
(
ch
,
attr
);
x
++
;
}
y
++
;
}
*/
break
;
case
"
BIN
"
:
if
(
!
(
f
.
open
(
"
rb
"
,
true
,
4096
)))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment