diff options
author | epoch <epoch@thebackupbox.net> | 2022-08-17 21:34:02 -0500 |
---|---|---|
committer | epoch <epoch@thebackupbox.net> | 2022-08-17 21:34:02 -0500 |
commit | 6492ba6b4107a4da228e18db4fc5fc871bfb0579 (patch) | |
tree | 11301c4e20d9a1448337e73b62a16ab1bfeba457 /share/hackvr/examples/dungen | |
parent | 49d54d7582bdcbdcff5637e72e9f29bb5cc571bd (diff) | |
download | hackvr-6492ba6b4107a4da228e18db4fc5fc871bfb0579.tar.gz hackvr-6492ba6b4107a4da228e18db4fc5fc871bfb0579.zip |
updated README to show that everything that got deleted went to an -extras repo. also, hackvr script updated to be better bashHEADmaster
Diffstat (limited to 'share/hackvr/examples/dungen')
-rw-r--r-- | share/hackvr/examples/dungen/Makefile | 8 | ||||
-rw-r--r-- | share/hackvr/examples/dungen/dun2ascii.c | 46 | ||||
-rw-r--r-- | share/hackvr/examples/dungen/dun2hackvr.c | 59 | ||||
-rwxr-xr-x | share/hackvr/examples/dungen/dunexplore.sh | 42 | ||||
-rw-r--r-- | share/hackvr/examples/dungen/dungen.c | 61 |
5 files changed, 0 insertions, 216 deletions
diff --git a/share/hackvr/examples/dungen/Makefile b/share/hackvr/examples/dungen/Makefile deleted file mode 100644 index cd05f4b..0000000 --- a/share/hackvr/examples/dungen/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY: all clean - -all: dungen dun2ascii dun2hackvr - -clean: - rm -f dungen - rm -f dun2ascii - rm -f dun2hackvr diff --git a/share/hackvr/examples/dungen/dun2ascii.c b/share/hackvr/examples/dungen/dun2ascii.c deleted file mode 100644 index d7a9996..0000000 --- a/share/hackvr/examples/dungen/dun2ascii.c +++ /dev/null @@ -1,46 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -//nsew -char *a[16]; - -char field[256]; - -void print_field() { - int i; - fprintf(stderr,"\x1b[H"); - for(i=0;i<(16*strlen(a[field[0]]))+1;i++) fprintf(stderr,"#"); - for(i=0;i<256;i++) { - if(i%16 == 0) fprintf(stderr,"#\n#"); - fprintf(stderr,"%s",a[field[i]]); - } - fprintf(stderr,"#\n"); - for(i=0;i<(16*strlen(a[field[0]]))+2;i++) fprintf(stderr,"#"); - fprintf(stderr,"\n"); -} - -int main(int argc,char *argv[]) { - int i; - fprintf(stderr,"\x1b[H\x1b[2J"); - a[0x0]=" "; - a[0x1]="- "; - a[0x2]=" -"; - a[0x3]="---"; - a[0x4]=" . "; - a[0x5]="-. "; - a[0x6]=" .-"; - a[0x7]="-.-"; - a[0x8]=" ' "; - a[0x9]="-' "; - a[0xa]=" '-"; - a[0xb]="-'-"; - a[0xc]=" | "; - a[0xd]="-| "; - a[0xe]=" |-"; - a[0xf]="-|-"; - while(read(0,field,sizeof(field)) > 0) { - print_field(); - sleep(1); - } -} diff --git a/share/hackvr/examples/dungen/dun2hackvr.c b/share/hackvr/examples/dungen/dun2hackvr.c deleted file mode 100644 index b67af14..0000000 --- a/share/hackvr/examples/dungen/dun2hackvr.c +++ /dev/null @@ -1,59 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <unistd.h> - -//nsew -char field[256]; - -#define NORTH_EXIT 8 -#define SOUTH_EXIT 4 -#define EAST_EXIT 2 -#define WEST_EXIT 1 - -int deg[]={0,180,270,90}; -int doorx[]={}; -int doory[]={}; - -void print_field() { - int i,d; - int x,y; - for(i=0;i<256;i++) { - //we need to draw the room here. - //each room will be... 16x16? sure.... - //we can use bitmasks to find which sides of the room need to be whole walls - //and which will contain passages to the next rooms - //whole walls are a single rectangle - //we need to loop over each wall and check if it has a passage through it - if(field[i]) { - for(d=0;d<4;d++) {//loop over the 4 possible directions/walls - x=(i%16) * 16 - (7 * 16); - y=(i/16) * -16 + 16; - if((field[i] & (1<<(3-d))) > 0) {//if this has an exit in this bit... - printf("wall_%d_%d addshape 2 4 -7 0 7 -7 8 7 -2 8 7 -2 0 7\n",i,d);//we need 4 parts for the doorway - printf("wall_%d_%d addshape 2 4 2 0 7 2 8 7 7 8 7 7 0 7\n",i,d); - if(d % 2) {//only do the south and west doorjams. every door has an opposite door that matches it anyway - printf("wall_%d_%d addshape 2 4 -2 0 7 -2 8 7 -2 8 9 -2 0 9\n",i,d); - printf("wall_%d_%d addshape 2 4 2 0 9 2 8 9 2 8 7 2 0 7\n",i,d); - printf("door_close_%d_%d addshape 3 4 0 0 0 0 8 0 4 8 0 4 0 0\n",i,d);//door needs to be built to where its hinge is at 0,y,0, then moved into place so opening will work. - printf("door_close_%d_%d rotate 0 %d 0\n",i,d,deg[d]); - if(d == 1) printf("door_close_%d_%d move %d 0 %d\n",i,d,x+2,y-8); - if(d == 3) printf("door_close_%d_%d move %d 0 %d\n",i,d,x-8,y-2); - } - } else {//no door in this wall - printf("wall_%d_%d addshape 2 4 -7 0 7 -7 8 7 7 8 7 7 0 7\n",i,d);//solid wall - } - printf("wall_%d_%d rotate 0 %d 0\n",i,d,deg[d]);//rotate this wall into position - printf("wall_%d_%d move %d 0 %d\n",i,d,x,y);//and put it in the right spot ofc - //the door needs to move either -2, +8 - } - } - } -} - -int main(int argc,char *argv[]) { - if(read(0,field,sizeof(field)) > 0) { - print_field(); - return 0; - } - return 1; -} diff --git a/share/hackvr/examples/dungen/dunexplore.sh b/share/hackvr/examples/dungen/dunexplore.sh deleted file mode 100755 index 6fbd5c3..0000000 --- a/share/hackvr/examples/dungen/dunexplore.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -### run me with hackvr_coproc -#the $USER triangle we add first is to give us some sort of avatar to see where the camera is. -#seed=1337 -red=1 -green=2 -blue=4 -echo $USER addshape 6 3 -1 0 -1 0 0 2 1 0 -1 ; echo $USER move 0 2 0 -echo world-x addshape $red 2 0 0 0 1 0 0 -echo world-y addshape $green 2 0 0 0 0 1 0 -echo world-z addshape $blue 2 0 0 0 0 0 1 -./dungen $seed | ./dun2hackvr -while read group action target;do - if [ "$action" = "action" ];then - if printf "%s\n" "${target}" | grep ^door_;then - printf "# clicked a door! %s\n" "${target}" >&2 - if printf "%s\n" "${target}" | grep ^door_open;then - tmp=$(printf "%s\n" "${target}" | sed 's/_open/_CLOSING/') - printf "%s renamegroup %s %s\n" ${target} ${target} ${tmp} - ( - for i in $(seq 1 5 90);do - printf "%s rotate 0 +5 0\n" ${tmp} - sleep .1 - done - tmp2=$(printf "%s\n" "${target}" | sed 's/_open/_close/') - printf "%s renamegroup %s %s\n" ${tmp} ${tmp} ${tmp2} - ) & - elif printf "%s\n" "${target}" | grep ^door_close;then - tmp=$(printf "%s\n" "${target}" | sed 's/_close/_OPENING/') - printf "%s renamegroup %s %s\n" ${target} ${target} ${tmp} - ( - for i in $(seq 1 5 90);do - printf "%s rotate 0 +-5 0\n" ${tmp} - sleep .1 - done - tmp2=$(printf "%s\n" "${target}" | sed 's/_close/_open/') - printf "%s renamegroup %s %s\n" ${tmp} ${tmp} ${tmp2} - ) & - fi - fi - fi -done diff --git a/share/hackvr/examples/dungen/dungen.c b/share/hackvr/examples/dungen/dungen.c deleted file mode 100644 index 738b395..0000000 --- a/share/hackvr/examples/dungen/dungen.c +++ /dev/null @@ -1,61 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#include <time.h> - -#define ITERATIONS 16 - -char field[256]; -char nfield[256]; - -void prune() {//remove paths into wall - int i; - memcpy(nfield,field,256);//make a copy just for comparison - for(i=0;i<256;i++) { - if(i%16 == 0) field[i] &= ~0x1;//remove all left exits at left of map - else if((field[i]&0x1) && !(nfield[i-1]&0x2)) field[i] &= ~0x1; - if(i%16 == 15) field[i] &= ~0x2;//remove all right exits at right of map. - else if((field[i]&0x2) && !(nfield[i+1]&0x1)) field[i] &= ~0x2; - if(i > 240) field[i] &= ~0x4; - else if((field[i]&0x4) && !(nfield[i+16]&0x8)) field[i] &= ~0x4; - if(i < 16) field[i] &= ~0x8; - else if((field[i]&0x8) && !(nfield[i-16]&0x4)) field[i] &= ~0x8; - } -} - -void grow() { - int i=0; - memcpy(nfield,field,256); - for(i=0;i<256;i++) { - if(random() % 2 == 0) { - if((field[i]&0x1) && !nfield[i-1] && i%16 != 0) nfield[i-1]=random()%16 | 0x2; - if((field[i]&0x2) && !nfield[i+1] && i%16 != 15) nfield[i+1]=random()%16 | 0x1; - if((field[i]&0x4) && !nfield[i+16] && i<240) nfield[i+16]=random()%16 | 0x8; - if((field[i]&0x8) && !nfield[i-16] && i>16) nfield[i-16]=random()%16 | 0x4; - } - } - memcpy(field,nfield,256); -} - -void dump() { - int i; - write(1,field,sizeof(field)); -} - -int main(int argc,char *argv[]) { - int i; - int seed=time(0) * getpid(); - if(argc > 1) { - seed=atoi(argv[1]); - } - srandom(seed); - field[7+16] = 0x4;//center top - for(i=0;i<ITERATIONS;i++) { - if(argc > 2) dump(); - grow(); - } - prune(); - dump(); -// fprintf(stderr,"seed: %d\n",seed); -} |