xfireworks-1.3.orig/0042755000175000017500000000000007142030233013577 5ustar kmutokmutoxfireworks-1.3.orig/NEWS0100644000175000017500000000000007142030233014257 0ustar kmutokmutoxfireworks-1.3.orig/Obj.c0100644000175000017500000002330507142030232014452 0ustar kmutokmuto/*****************************************************************************/ /* Obj.c - A library for object list. */ /* */ /* Obj.c Copyright (c) 2000 Sakai Hiroaki. */ /* All Rights Reserved. */ /*****************************************************************************/ #include "ObjP.h" /*****************************************************************************/ /* ObjListData 型の操作 */ /*****************************************************************************/ static ObjListData ObjListData_Create(Obj obj, Obj (*destructor)()) { ObjListData list_data; list_data = (ObjListData)malloc(sizeof(_ObjListData)); list_data->obj = obj; list_data->destructor = destructor; return (list_data); } static ObjListData ObjListData_Destroy(ObjListData list_data) { if (list_data == NULL) return (NULL); /* デストラクタの実行 */ if (list_data->destructor) (*(list_data->destructor))(list_data->obj); free(list_data); return (NULL); } /*****************************************************************************/ /* ObjList 型オブジェクトの操作 */ /*****************************************************************************/ Obj ObjListData_GetObj(ObjListData data) { if (data == NULL) return (NULL); return (data->obj); } Obj ObjListData_GetPrev(ObjListData data) { if (data == NULL) return (NULL); return (data->prev); } Obj ObjListData_GetNext(ObjListData data) { if (data == NULL) return (NULL); return (data->next); } int ObjList_GetLength(ObjList list) { if (list == NULL) return (-1); return (list->length); } ObjListData ObjList_GetStartEdge(ObjList list) { if (list == NULL) return (NULL); return (list->start_edge); } ObjListData ObjList_GetEndEdge(ObjList list) { if (list == NULL) return (NULL); return (list->end_edge); } ObjListData ObjList_GetStart(ObjList list) { if (list == NULL) return (NULL); return (list->start_edge->next); } ObjListData ObjList_GetEnd(ObjList list) { if (list == NULL) return (NULL); return (list->end_edge->prev); } int ObjList_IsEmpty(ObjList list) { if (list == NULL) return (1); return (list->start_edge->next == list->end_edge); } int ObjList_IsStartEdge(ObjList list, ObjListData data) { if (list == NULL) return (0); return (data == list->start_edge); } int ObjList_IsEndEdge(ObjList list, ObjListData data) { if (list == NULL) return (0); return (data == list->end_edge); } int ObjList_IsStart(ObjList list, ObjListData data) { if (list == NULL) return (0); return (data == list->start_edge->next); } int ObjList_IsEnd(ObjList list, ObjListData data) { if (list == NULL) return (0); return (data == list->end_edge->prev); } ObjListData ObjList_InsertObjToPrev(ObjList list, ObjListData current, Obj obj, Obj (*destructor)()) { ObjListData data; if (list == NULL) return (NULL); if (ObjList_IsStartEdge(list, current)) return (NULL); data = ObjListData_Create(obj, destructor); if (data == NULL) return (NULL); data->prev = current->prev; data->next = current; current->prev->next = data; current->prev = data; (list->length)++; return (data); } ObjListData ObjList_InsertObjToNext(ObjList list, ObjListData current, Obj obj, Obj (*destructor)()) { ObjListData data; if (list == NULL) return (NULL); if (ObjList_IsEndEdge(list, current)) return (NULL); data = ObjListData_Create(obj, destructor); if (data == NULL) return (NULL); data->next = current->next; data->prev = current; current->next->prev = data; current->next = data; (list->length)++; return (data); } ObjListData ObjList_InsertObjToStart(ObjList list, Obj obj, Obj (*destructor)()) { ObjListData current; current = ObjList_GetStart(list); return (ObjList_InsertObjToPrev(list, current, obj, destructor)); } ObjListData ObjList_InsertObjToEnd(ObjList list, Obj obj, Obj (*destructor)()) { ObjListData current; current = ObjList_GetEnd(list); return (ObjList_InsertObjToNext(list, current, obj, destructor)); } ObjListData ObjList_DeleteObjToPrev(ObjList list, ObjListData current) { ObjListData ret; if (list == NULL) return (NULL); if (ObjList_IsStartEdge(list, current) || ObjList_IsEndEdge(list, current)) return (NULL); current->prev->next = current->next; current->next->prev = current->prev; ret = current->prev; ObjListData_Destroy(current); (list->length)--; return (ret); } ObjListData ObjList_DeleteObjToNext(ObjList list, ObjListData current) { ObjListData ret; if (list == NULL) return (NULL); if (ObjList_IsStartEdge(list, current) || ObjList_IsEndEdge(list, current)) return (NULL); current->prev->next = current->next; current->next->prev = current->prev; ret = current->next; ObjListData_Destroy(current); (list->length)--; return (ret); } ObjListData ObjList_DeleteObjFromStart(ObjList list) { ObjListData current; if (list == NULL) return (NULL); current = ObjList_GetStart(list); return (ObjList_DeleteObjToNext(list, current)); } ObjListData ObjList_DeleteObjFromEnd(ObjList list) { ObjListData current; if (list == NULL) return (NULL); current = ObjList_GetEnd(list); return (ObjList_DeleteObjToPrev(list, current)); } ObjListData ObjList_MoveObjToPrev(ObjList list, ObjListData current, ObjListData to) { if (list == NULL) return (NULL); return (ObjList_MoveObjToPrevOfOtherList(list, current, list, to)); } ObjListData ObjList_MoveObjToNext(ObjList list, ObjListData current, ObjListData to) { if (list == NULL) return (NULL); return (ObjList_MoveObjToNextOfOtherList(list, current, list, to)); } ObjListData ObjList_MoveObjToStart(ObjList list, ObjListData current) { if (list == NULL) return (NULL); return (ObjList_MoveObjToStartOfOtherList(list, current, list)); } ObjListData ObjList_MoveObjToEnd(ObjList list, ObjListData current) { if (list == NULL) return (NULL); return (ObjList_MoveObjToEndOfOtherList(list, current, list)); } ObjList ObjList_Create() /* ObjList 型オブジェクトを作成する */ { ObjList list; list = (ObjList)malloc(sizeof(_ObjList)); if (list == NULL) return (NULL); list->start_edge = ObjListData_Create(NULL, NULL); list->end_edge = ObjListData_Create(NULL, NULL); list->length = 0; /* 現在存在しているデータの数 */ list->start_edge->prev = NULL; list->start_edge->next = list->end_edge; list->end_edge->prev = list->start_edge; list->end_edge->next = NULL; return (list); } ObjList ObjList_Destroy(ObjList list) /* */ { if (list == NULL) return (NULL); while (!ObjList_IsEmpty(list)) ObjList_DeleteObjFromStart(list); if (list->start_edge) list->start_edge = ObjListData_Destroy(list->start_edge); if (list->end_edge) list->end_edge = ObjListData_Destroy(list->end_edge); free(list); return (NULL); } /*===========================================================================*/ /* 複数のリスト間での操作 */ /*===========================================================================*/ ObjListData ObjList_MoveObjToPrevOfOtherList(ObjList list, ObjListData current, ObjList to_list, ObjListData to) { if (list == NULL) return (NULL); if (to_list == NULL) return (NULL); if (ObjList_IsStartEdge(list, current) || ObjList_IsEndEdge(list, current)) return (NULL); if (ObjList_IsStartEdge(to_list, to)) return (NULL); if ((list == to_list) && (current == to)) return (current); current->prev->next = current->next; current->next->prev = current->prev; current->prev = to->prev; current->next = to; to->prev->next = current; to->prev = current; (list->length)--; (to_list->length)++; return (current); } ObjListData ObjList_MoveObjToNextOfOtherList(ObjList list, ObjListData current, ObjList to_list, ObjListData to) { if (list == NULL) return (NULL); if (ObjList_IsStartEdge(list, current) || ObjList_IsEndEdge(list, current)) return (NULL); if (ObjList_IsEndEdge(to_list, to)) return (NULL); if ((list == to_list) && (current == to)) return (current); current->prev->next = current->next; current->next->prev = current->prev; current->next = to->next; current->prev = to; to->next->prev = current; to->next = current; (list->length)--; (to_list->length)++; return (current); } ObjListData ObjList_MoveObjToStartOfOtherList(ObjList list, ObjListData current, ObjList to_list) { ObjListData to; if (list == NULL) return (NULL); if (to_list == NULL) return (NULL); to = ObjList_GetStart(to_list); return (ObjList_MoveObjToPrevOfOtherList(list, current, to_list, to)); } ObjListData ObjList_MoveObjToEndOfOtherList(ObjList list, ObjListData current, ObjList to_list) { ObjListData to; if (list == NULL) return (NULL); if (to_list == NULL) return (NULL); to = ObjList_GetEnd(to_list); return (ObjList_MoveObjToNextOfOtherList(list, current, to_list, to)); } ObjList ObjList_Concatenate(ObjList list1, ObjList list2) { ObjListData tmp; if (list1 == NULL) { list1 = list2; return (list1); } if (list2 == NULL) return (list1); list1->end_edge->prev->next = list2->start_edge->next; list2->start_edge->next->prev = list1->end_edge->prev; tmp = list1->end_edge; list1->end_edge = list2->end_edge; list2->end_edge = tmp; list2->start_edge->next = list2->end_edge; list2->end_edge->prev = list2->start_edge; list1->length += list2->length; list2->length = 0; ObjList_Destroy(list2); return (list1); } /* End of File. */ xfireworks-1.3.orig/Obj.h0100644000175000017500000000657207142030233014467 0ustar kmutokmuto/*****************************************************************************/ /* Obj.h - A library for object list. */ /* */ /* Obj.h Copyright (c) 2000 Sakai Hiroaki. */ /* All Rights Reserved. */ /*****************************************************************************/ #ifndef _SAKAILIB_OBJ_H_INCLUDED_ #define _SAKAILIB_OBJ_H_INCLUDED_ typedef void * Obj; typedef struct _ObjListData * ObjListData; typedef struct _ObjList * ObjList; typedef Obj (*ObjDestructor)(Obj); #include #include /*****************************************************************************/ /* ObjList 型オブジェクトの操作 */ /*****************************************************************************/ Obj ObjListData_GetObj(ObjListData data); Obj ObjListData_GetPrev(ObjListData data); Obj ObjListData_GetNext(ObjListData data); int ObjList_GetLength(ObjList list); ObjListData ObjList_GetStartEdge(ObjList list); ObjListData ObjList_GetEndEdge(ObjList list); ObjListData ObjList_GetStart(ObjList list); ObjListData ObjList_GetEnd(ObjList list); int ObjList_IsEmpty(ObjList list); int ObjList_IsStartEdge(ObjList list, ObjListData data); int ObjList_IsEndEdge(ObjList list, ObjListData data); int ObjList_IsStart(ObjList list, ObjListData data); int ObjList_IsEnd(ObjList list, ObjListData data); ObjListData ObjList_InsertObjToPrev(ObjList list, ObjListData current, Obj obj, Obj (*destructor)()); ObjListData ObjList_InsertObjToNext(ObjList list, ObjListData current, Obj obj, Obj (*destructor)()); ObjListData ObjList_InsertObjToStart(ObjList list, Obj obj, Obj (*destructor)()); ObjListData ObjList_InsertObjToEnd(ObjList list, Obj obj, Obj (*destructor)()); ObjListData ObjList_DeleteObjToPrev(ObjList list, ObjListData current); ObjListData ObjList_DeleteObjToNext(ObjList list, ObjListData current); ObjListData ObjList_DeleteObjFromStart(ObjList list); ObjListData ObjList_DeleteObjFromEnd(ObjList list); ObjListData ObjList_MoveObjToPrev(ObjList list, ObjListData current, ObjListData to); ObjListData ObjList_MoveObjToNext(ObjList list, ObjListData current, ObjListData to); ObjListData ObjList_MoveObjToStart(ObjList list, ObjListData current); ObjListData ObjList_MoveObjToEnd(ObjList list, ObjListData current); ObjList ObjList_Create(); /* ObjList 型オブジェクトを作成する */ ObjList ObjList_Destroy(ObjList list); /* */ /*===========================================================================*/ /* 複数のリスト間での操作 */ /*===========================================================================*/ ObjListData ObjList_MoveObjToPrevOfOtherList(ObjList list, ObjListData current, ObjList to_list, ObjListData to); ObjListData ObjList_MoveObjToNextOfOtherList(ObjList list, ObjListData current, ObjList to_list, ObjListData to); ObjListData ObjList_MoveObjToStartOfOtherList(ObjList list, ObjListData current, ObjList to_list); ObjListData ObjList_MoveObjToEndOfOtherList(ObjList list, ObjListData current, ObjList to_list); ObjList ObjList_Concatenate(ObjList list1, ObjList list2); #endif xfireworks-1.3.orig/etc.c0100644000175000017500000000251707142030232014515 0ustar kmutokmuto#include "etc.h" int Error(char * funcname, char * message) { fprintf(stderr, "Error in %s:%s\n", funcname, message); exit (1); } void InitializeRand() { srand((unsigned)time(NULL)); } int Rand(int n) { #if 1 return (rand() % n); #else return (rand() / (RAND_MAX / n + 1)); #endif } double DoubleRand(double d) { return ((double)Rand(10001) / 10000.0 * d); } /* #include なのか #include なのかの */ /* 移植性の問題がイヤだったので,strdup() や strcpy() や strcpy() を使わず, */ /* 独自に書いた. */ int StringLen(char * str) { int i; for (i = 0; str[i] != '\0'; i++) { /* None */ } return (i); } int StringCpy(char * dst, char * src) { int i; for (i = 0; src[i] != '\0'; i++) { dst[i] = src[i]; } dst[i] = '\0'; return (i); } int StringCat(char * dst, char * src) { return (StringCpy(dst + StringLen(dst), src)); } int StringCmp(char * str1, char * str2) { int i = 0; while (1) { if ( (str1[i] == '\0') && (str2[i] == '\0') ) return (0); if (str1[i] == '\0') return (-1); if (str2[i] == '\0') return ( 1); if (str1[i] > str2[i]) return ( 1); if (str1[i] < str2[i]) return (-1); i++; } } int StringEqual(char * str1, char * str2) { return (!StringCmp(str1, str2)); } /* End of Program */ xfireworks-1.3.orig/etc.h0100644000175000017500000000065007142030232014516 0ustar kmutokmuto#ifndef _Etc_h_INCLUDED_ #define _Etc_h_INCLUDED_ #include #include int Error(char * funcname, char * message); void InitializeRand(); int Rand(int n); double DoubleRand(double d); int StringLen(char * str); int StringCpy(char * dst, char * src); int StringCat(char * dst, char * src); int StringCmp(char * str1, char * str2); int StringEqual(char * str1, char * str2); #endif /* End of Program */ xfireworks-1.3.orig/CalculatorP.h0100644000175000017500000000064707142030233016163 0ustar kmutokmuto#ifndef _CalculatorP_h_INCLUDED_ #define _CalculatorP_h_INCLUDED_ #include "Calculator.h" typedef struct _Calculator { int degree_number; double * sine; } _Calculator; #endif /*****************************************************************************/ /* End of Program */ /*****************************************************************************/ xfireworks-1.3.orig/xfireworks.10100644000175000017500000001463607142030233016071 0ustar kmutokmuto.\" .\" XFireworks Copyright (c) 2000 SAKAI Hiroaki. .\" All Rights Reserved. .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 2, or (at your option) .\" any later version. .\" .TH XFIREWORKS 1 "Release 6" "X Version 11" .SH NAME XFireworks - Fireworks in the root window on X. .SH SYNOPSIS .B xfireworks [ options ] .SH DESCRIPTION XFireworks makes fireworks in the root window on X. .br This is imitation of Japanese "Hanabi Taikai". It is very popular event in Japanese summer and performed on some rivers. Sumidagawa River's Hanabi Taikai is very popular. The author has seen Arakawa River's Hanabi Taikai every year. .SH OPTIONS .TP 8 .B -h, -help Output help messages. .TP 8 .B -display [displayname] The name of the X server to use. .TP 8 .B -bg, -background, -background-color [color name] Background color of the root window. .TP 8 .B -f, -file [filename] The name of the file to configure fireworks. Default configure file is ./xfireworks.conf .TP 8 .B -wait [wait time] Wait time for micro seconds. .TP 8 .B -fine [number] Steps of moving pieces of fireworks for percent. Default value is 100. .br If this value is small, xfireworks runs quickly and speedy. .TP 8 .B -gradation [number] Color gradation. Default value is 16. .br If color gradation is a little, colors are shared, memory of X server and xfireworks are saved, and xfireworks starts up quickly. .TP 8 .B -direct-draw XFireworks draw fireworks in the root window directly. (Default) .TP 8 .B -no-direct-draw XFireworks draw fireworks in a pixmap and copy it to the root window as a background pixmap. If xfireworks don't run properly or you want to run XFireworks as a background pixmap, try this option. .TP 8 .B -probability, -probability-magnification [number] Magnification of probability of performing fireworks for percent. Default value is 100. .br If this value is small, fireworks is very silent. .br If this value is large, fireworks is very loud. .TP 8 .B -size, -size-magnification [number] Magnification of size of pieces for percent. Default value is 100. .TP 8 .B -air, -air-magnification [number] Magnification of air resistance for percent. Default value is 100. .TP 8 .B -gravity, -gravity-magnification [number] Magnification of gravity for percent. Default value is 100. .TP 8 .B -transmission, -transmission-magnification [number] Magnification of velocity transmission for percent. Default value is 100. .TP 8 .B -after-image, -after-image-magnification [number] Magnification of after images length for percent. Default value is 100. .br If this value is large, length of after images is very long. .TP 8 .B -color-length, -color-length-magnification [number] Magnification of color change length for percent. Default value is 100. .TP 8 .B -next-power, -next-power-magnification [number] Magnification of pieces explosion power for percent. Default value is 100. .TP 8 .B -next-number, -next-number-magnification [number] Magnification of the number of pieces for percent. Default value is 100. .br If this value is small, fireworks is very silent. .br If this value is large, fireworks is very loud. .SH EXAMPLES If your machine is very slow, try .br > xfireworks -fine 75 -after-image 75 .PP If your machine has less colors, try .br > xfireworks -gradation 5 .br XFireworks use 5x5x5=125 colors. .PP If you have very high spec machine, try .br > xfireworks -fine 200 -after-image 150 -gradation 64 -wait 10000 .PP If you like simple fireworks (it's Japanese "Wabi Sabi"), try .br > xfireworks -probability 50 .PP If you like loud fireworks, try .br > xfireworks -probability 500 -after-image 200 -next-number 120 .PP If xfireworks don't run properly, try .br > xfireworks -direct-draw .br or .br > xfireworks -no-direct-draw .SH "SEE ALSO" X(1) .SH FILES .B ./xfireworks.conf, /lib/X11/XFireworks/xfireworks.conf .PP The default file to configure XFireworks. .PP XFireworks search the configuration file in the current directry at first. If not exist, second, XFireworks search "/lib/X11/XFireworks". If not exist, XFireworks use the default data in itself at last. .PP You can get the newest xfireworks.conf from the web page of XFireworks. The newest xfireworks.conf has more kinds of fireworks and is more beautiful. .SH "Q AND A" .PP Q. .br All of fireworks are white. .PP A. .br Your machine have less colors. Use -gradation option and decrease the number of colors to use. .PP Q. .br If I use gmc (GNOME file manager), xfireworks runs very slow. .PP A. .br Try -no-direct-draw option. .PP Q. .br I want to put fireworks on the root window as a background picture. But, if I stop xfireworks with Ctrl-C, the root window is cleaned. .PP A. .br Try -no-direct-draw option. If you run xfireworks with -no-direct-draw option, xfireworks don't clean the root window when you stop xfireworks. .PP Q. .br If I use xfireworks with -fine 500 -after-image 500 options, movements of fireworks are not smoothly. .PP A. .br Try -no-direct-draw option. If you run xfireworks with -no-direct-draw option, xfireworks draw fireworks on a pixmap and copy it to the root window, and movements of fireworks are smoothly. .PP Q. .br I want to see more beautiful fireworks! .PP A. .br Access the XFireworks's web page and download the newest xfireworks.conf. .PP Q. .br I want to make my original fireworks! .PP A. .br Edit xfireworks.conf. If you make more beautiful fireworks, please send it to the author. .SH AUTHOR Programed by SAKAI Hiroaki. .br E-Mail: sakai@seki.ee.kagu.sut.ac.jp, hsakai@pfu.co.jp .br Web site: .br http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/index.html .br Mirror site: .br http://hp.vector.co.jp/authors/VA014157/myfreesoft/index.html .br http://www.people.or.jp/~hsakai/myfreesoft/index.html .br If you want the newest xfireworks.conf, access these web pages. .SH "SPECIAL THANKS" Hashimoto Jun for many advices and test on Linux. .br Simosako Akira for test on Linux and many informations. .br Koga Kazuhiro for test on Linux. .br Umehara Taro for test on FreeBSD. .br Morimi Asuka for many advices. .SH COPYRIGHT XFireworks Copyright (c) 2000 SAKAI Hiroaki. .br All Rights Reserved. .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. xfireworks-1.3.orig/xfireworks.conf0100644000175000017500000006015407142030233016652 0ustar kmutokmuto############################################################################### # This is XFireworks configure file. # # XFireworks Copyright (c) 2000 Sakai Hiroaki. # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ############################################################################### ############################################################################### # Default Values ############################################################################### DefaultProbability 0.07 DefaultSize 3 DefaultAir 0.05 DefaultGravity 0.25 DefaultTransmission 30.0 DefaultAfterImage 7 ############################################################################### # Normal ############################################################################### Name Normal1-1 Probability Default Next "NormalChange1 10 40 NormalChange2 10 40" Name Normal1-2 Probability Default Next "NormalChange3 10 80" Name Normal1-3 Probability Default Next "NormalChange4 10 40 NormalChange5 10 40" Name Normal1-4 Probability Default Next "NormalChange6 10 40 NormalChange7 10 40" Name Normal1-5 Probability Default Next "NormalChange8 15 40 NormalChange9 15 40" Name Normal1-6 Probability Default Next "NormalChange1 15 80" Name Normal1-7 Probability Default Next "NormalChange6 15 300" Name Normal2 Probability Default Next "Normal2-1 7 5 Normal2-2 7 5" Name Normal2-1 Color "white red 3 red yellow 40" Next "NormalChange1 5.0 4 NormalChange2 5.0 4 NormalChange3 5.0 4" Name Normal2-2 Color "white green 3 green yellow 40" Next "NormalChange1 5.0 4 NormalChange2 5.0 4 NormalChange3 5.0 4" Name Normal3 Probability Default Next "Normal3-1 15 15" Name Normal3-1 Color "white red 3 red yellow 6" Next "NormalChange3 10 5 NormalChange4 10 5" Name Normal4 Probability Default Next "Normal4-1 5 2 Normal4-2 5 2 Normal4-3 5 2 Normal4-4 5 2" Next "Normal4-5 5 2 Normal4-6 5 2 Normal4-7 5 2 Normal4-8 5 2" Next "Normal4-9 5 2 Normal4-10 5 2 Normal4-11 5 2 Normal4-12 5 2" Next "Normal4-13 5 2 Normal4-14 5 2 Normal4-15 5 2 Normal4-16 5 2" Name Normal4Dash Probability Default Next "Normal4-1 5 2 Normal4-2 5 2 Normal4-3 5 2 Normal4-4 5 2" Next "Normal4-5 5 2 Normal4-6 5 2 Normal4-7 5 2 Normal4-8 5 2" Next "Normal4-9 5 2 Normal4-10 5 2 Normal4-11 5 2 Normal4-12 5 2" Next "Normal4-13 5 2 Normal4-14 5 2 Normal4-15 5 2 Normal4-16 5 2" Next "Normal4-Ban 0 1" Name Normal4-1 AfterImage 0 Color "none none 4" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-2 AfterImage 0 Color "none none 8" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-3 AfterImage 0 Color "none none 12" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-4 AfterImage 0 Color "none none 16" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-5 AfterImage 0 Color "none none 20" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-6 AfterImage 0 Color "none none 24" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-7 AfterImage 0 Color "none none 28" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-8 AfterImage 0 Color "none none 32" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-9 AfterImage 0 Color "none none 36" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-10 AfterImage 0 Color "none none 40" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-11 AfterImage 0 Color "none none 44" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-12 AfterImage 0 Color "none none 48" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-13 AfterImage 0 Color "none none 52" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-14 AfterImage 0 Color "none none 56" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-15 AfterImage 0 Color "none none 60" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-16 AfterImage 0 Color "none none 64" Next "NormalChange5 10 5 NormalChange8 10 5" Name Normal4-Ban AfterImage 0 Color "none none 68" Next "NormalChange1 15 60" Name NormalChange1 Color "white red 5 red green 20 green blue 30 blue none 30" Name NormalChange2 Color "white orange 5 orange none 20 none blue 30 blue none 30" Name NormalChange3 Color "white brown 5 brown orange 20 orange green 30 green none 30" Name NormalChange4 Color "white green 5 green none 20 none red 30 red none 30" Name NormalChange5 Color "white salmon 5 salmon orange 20 orange cyan 30 cyan none 30" Name NormalChange6 Color "white magenta 5 magenta khaki 20 khaki violet 30 violet none 30" Name NormalChange7 Color "white blue 5 blue none 20 none gold 30 gold none 30" Name NormalChange8 Color "white coral 5 coral plum 20 plum orchid 30 orchid none 30" Name NormalChange9 Color "white tan 5 tan sienna 20 sienna linen 30 linen none 30" ############################################################################### # Fade in type ############################################################################### Name FadeIn1 Probability Default Next "FadeInChange1-1 10.0 50 FadeInChange1-2 15.0 50" Name FadeIn2 Probability Default Next "FadeInChange1-3 15.0 100" Name FadeIn3 Probability Default Next "FadeInChange2-1 15.0 10 FadeInChange2-2 15.0 10" Name FadeInChange11-1 Color "white yellow 3 yellow yellow 2 none none 7 none purple 3" Color "purple yellow 10 yellow cyan 10 cyan purple 10" Color "purple white 10 white none 30" Name FadeInChange11-2 Color "white cyan 3 cyan cyan 2 none none 7 none yellow 3" Color "yellow cyan 10 cyan purple 10 purple yellow 10" Color "yellow white 10 white none 30" Name FadeInChange1-3 Color "white pink 3 none none 7 none tomato 3" Color "tomato brown 10 brown magenta 10 magenta thistle 10" Color "thistle ivory 10 ivory none 30" Name FadeInChange2-1 Color "white yellow 3 yellow yellow 2 none none 5" Color "none yellow 5 yellow yellow 5" Next "NormalChange1 10 5 NormalChange2 10 5 NormalChange3 10 5" Name FadeInChange2-2 Color "white yellow 3 yellow yellow 2 none none 5" Color "none yellow 5 yellow yellow 5" Color "yellow red 5 red purple 5" Next "NormalChange4 10 10 NormalChange5 10 10" ############################################################################### # Shidare Yanagi ############################################################################### Name Shidare1 Probability Default Next "ShidareChange1 15.0 60" Name Shidare2 Probability Default Next "ShidareChange2 15.0 25" Name Shidare3 Probability Default Next "ShidareChange1 10.0 70" Name Shidare4 Probability Default Next "ShidareChange3 10.0 70" Name ShidareChange1 AfterImage 15 Color "white brown 5 brown yellow 15 yellow red 15" Color "red purple 15 purple none 30" Name ShidareChange2 AfterImage 15 Color "white yellow 5 yellow red 20" Next "ShidareChange1 7.0 5" Name ShidareChange3 AfterImage 15 Color "white magenta 5 magenta orange 10 orange brown 10 brown gold 10" Color "gold pink 10 pink green 10 green none 30" Name Shidare5 Probability Default Next "Shidare5-1 7.0 5 Shidare5-2 7.0 5 Shidare5-3 7.0 5" Next "Shidare5-4 7.0 5 Shidare5-5 7.0 5 Shidare5-6 7.0 5" Next "Shidare5-7 7.0 5 Shidare5-8 7.0 5 Shidare5-9 7.0 5" Name Shidare5-1 AfterImage 0 Color "none none 10" Next "ShidareChange1 7.0 5" Name Shidare5-2 AfterImage 0 Color "none none 20" Next "ShidareChange1 7.0 5" Name Shidare5-3 AfterImage 0 Color "none none 30" Next "ShidareChange1 7.0 5" Name Shidare5-4 AfterImage 0 Color "none none 40" Next "ShidareChange1 7.0 5" Name Shidare5-5 AfterImage 0 Color "none none 50" Next "ShidareChange1 7.0 5" Name Shidare5-6 AfterImage 0 Color "none none 60" Next "ShidareChange1 7.0 5" Name Shidare5-7 AfterImage 0 Color "none none 70" Next "ShidareChange1 7.0 5" Name Shidare5-8 AfterImage 0 Color "none none 80" Next "ShidareChange1 7.0 5" Name Shidare5-9 AfterImage 0 Color "none none 90" Next "ShidareChange1 7.0 5" Name Shidare6 Probability Default Next "Shidare6-A 8 1 Shidare6-B 8 1 Shidare6-C 8 1 Shidare6-D 8 1" Next "Shidare6-E 8 1 Shidare6-F 8 1 Shidare6-G 8 1 Shidare6-H 8 1" Next "Shidare6-I 8 1 Shidare6-J 8 1 Shidare6-K 8 1 Shidare6-L 8 1" Next "Shidare6-M 8 1 Shidare6-N 8 1 Shidare6-O 8 1 Shidare6-P 8 1" Next "Shidare6-Q 8 1 Shidare6-R 8 1 Shidare6-S 8 1 Shidare6-T 8 1" Next "Shidare6-U 8 1 Shidare6-V 8 1 Shidare6-W 8 1 Shidare6-X 8 1" Next "Shidare6-Y 8 1 Shidare6-Z 8 1" Name Shidare6-A Gravity 0 Color "none none 0" Next "ShidareChange1 5 12" Name Shidare6-B Gravity 0 Color "none none 10" Next "ShidareChange1 5 12" Name Shidare6-C Gravity 0 Color "none none 20" Next "ShidareChange1 5 12" Name Shidare6-D Gravity 0 Color "none none 30" Next "ShidareChange1 5 12" Name Shidare6-E Gravity 0 Color "none none 40" Next "ShidareChange1 5 12" Name Shidare6-F Gravity 0 Color "none none 50" Next "ShidareChange1 5 12" Name Shidare6-G Gravity 0 Color "none none 60" Next "ShidareChange1 5 12" Name Shidare6-H Gravity 0 Color "none none 70" Next "ShidareChange1 5 12" Name Shidare6-I Gravity 0 Color "none none 80" Next "ShidareChange1 5 12" Name Shidare6-J Gravity 0 Color "none none 90" Next "ShidareChange1 5 12" Name Shidare6-K Gravity 0 Color "none none 100" Next "ShidareChange1 5 12" Name Shidare6-L Gravity 0 Color "none none 110" Next "ShidareChange1 5 12" Name Shidare6-M Gravity 0 Color "none none 120" Next "ShidareChange1 5 12" Name Shidare6-N Gravity 0 Color "none none 130" Next "ShidareChange1 5 12" Name Shidare6-O Gravity 0 Color "none none 140" Next "ShidareChange1 5 12" Name Shidare6-P Gravity 0 Color "none none 150" Next "ShidareChange1 5 12" Name Shidare6-Q Gravity 0 Color "none none 160" Next "ShidareChange1 5 12" Name Shidare6-R Gravity 0 Color "none none 170" Next "ShidareChange1 5 12" Name Shidare6-S Gravity 0 Color "none none 180" Next "ShidareChange1 5 12" Name Shidare6-T Gravity 0 Color "none none 190" Next "ShidareChange1 5 12" Name Shidare6-U Gravity 0 Color "none none 200" Next "ShidareChange1 5 12" Name Shidare6-V Gravity 0 Color "none none 210" Next "ShidareChange1 5 12" Name Shidare6-W Gravity 0 Color "none none 220" Next "ShidareChange1 5 12" Name Shidare6-X Gravity 0 Color "none none 230" Next "ShidareChange1 5 12" Name Shidare6-Y Gravity 0 Color "none none 240" Next "ShidareChange1 5 12" Name Shidare6-Z Gravity 0 Color "none none 250" Next "ShidareChange1 5 12" ############################################################################### # PachiPachi ############################################################################### Name PachiPachi1 Probability Default Next "PachiPachi1-1 0 1 PachiPachi1-2 0 1 PachiPachi1-3 0 1" Name PachiPachi1-1 AfterImage 0 Color "none none 1" Next "PachiPachiRed1 10 10 PachiPachiRed2 10 10" Next "PachiPachiGreen1 10 10 PachiPachiGreen2 10 10" Name PachiPachi1-2 AfterImage 0 Color "none none 4" Next "PachiPachiRed1 10 10 PachiPachiRed2 10 10" Next "PachiPachiGreen1 10 10 PachiPachiGreen2 10 10" Name PachiPachi1-3 AfterImage 0 Color "none none 8" Next "PachiPachiRed1 10 10 PachiPachiRed2 10 10" Next "PachiPachiGreen1 10 10 PachiPachiGreen2 10 10" Name PachiPachiRed1 AfterImage 2 Color "red red 2 none none 2 red red 3" Color "none none 2 red red 2 none none 3" Color "red red 2 none none 2 red red 3" Color "none none 2 red red 2 none none 3" Color "red red 2 none none 2 red red 3" Color "none none 2 red red 2 none none 3" Color "red red 2 none none 3 red red 3" Color "red none 30" Name PachiPachiRed2 AfterImage 2 Color "red red 4 none none 3 red red 4" Color "none none 3 red red 4 none none 3" Color "red red 4 none none 3 red red 4" Color "none none 3 red red 4 none none 3" Color "red red 4 none none 4 red none 30" Name PachiPachiGreen1 AfterImage 2 Color "green green 2 none none 3 green green 2" Color "none none 3 green green 2 none none 3" Color "green green 2 none none 3 green green 2" Color "none none 3 green green 2 none none 3" Color "green green 2 none none 3 green green 2" Color "none none 3 green green 2 none none 3" Color "green green 2 none none 3 green none 30" Name PachiPachiGreen2 AfterImage 2 Color "green green 3 none none 4 green green 3" Color "none none 2 green green 3 none none 4" Color "green green 3 none none 2 green green 3" Color "none none 4 green green 3 none none 2" Color "green green 3 none none 4 green green 3" Color "none none 2 green green 2 green none 30" #------------------------------------------------------------------------------ # Pachi Pachi 2 #------------------------------------------------------------------------------ Name PachiPachi2 Probability Default Next "PachiPachi2-1 10.0 2" Next "PachiPachi2-2 10.0 2" Next "PachiPachi2-3 10.0 2" Next "PachiPachi2-4 10.0 2" Next "PachiPachi2-5 10.0 2" Next "PachiPachi2-6 10.0 2" Next "PachiPachi2-7 10.0 2" Next "PachiPachi2-8 10.0 2" Next "PachiPachi2-9 10.0 2" Name PachiPachi2-1 AfterImage 0 Color "none none 8" Next "PachiPachi2-End 10 10" Name PachiPachi2-2 AfterImage 0 Color "none none 10" Next "PachiPachi2-End 10 10" Name PachiPachi2-3 AfterImage 0 Color "none none 12" Next "PachiPachi2-End 10 10" Name PachiPachi2-4 AfterImage 0 Color "none none 14" Next "PachiPachi2-End 10 10" Name PachiPachi2-5 AfterImage 0 Color "none none 16" Next "PachiPachi2-End 10 10" Name PachiPachi2-6 AfterImage 0 Color "none none 18" Next "PachiPachi2-End 10 10" Name PachiPachi2-7 AfterImage 0 Color "none none 20" Next "PachiPachi2-End 10 10" Name PachiPachi2-8 AfterImage 0 Color "none none 22" Next "PachiPachi2-End 10 10" Name PachiPachi2-9 AfterImage 0 Color "none none 24" Next "PachiPachi2-End 10 10" Name PachiPachi2-End AfterImage 2 Color "white green 5 green green 3 none none 5" Color "red red 3 none none 5" Color "blue blue 3" #------------------------------------------------------------------------------ # Pachi Pachi 3 #------------------------------------------------------------------------------ Name PachiPachi3 Probability Default Next "PachiPachi3-1 10 2" Next "PachiPachi3-2 10 2" Next "PachiPachi3-3 10 2" Next "PachiPachi3-4 10 2" Next "PachiPachi3-5 10 2" Next "PachiPachi3-6 10 2" Next "PachiPachi3-7 10 2" Next "PachiPachi3-8 10 2" Next "PachiPachi3-9 10 2" Name PachiPachi3-1 AfterImage 0 Color "none none 4" Next "PachiPachi3-End-1 7.0 4 PachiPachi3-End-2 7.0 4" Name PachiPachi3-2 AfterImage 0 Color "none none 6" Next "PachiPachi3-End-1 7.0 4 PachiPachi3-End-2 7.0 4" Name PachiPachi3-3 AfterImage 0 Color "none none 8" Next "PachiPachi3-End-1 7.0 4 PachiPachi3-End-2 7.0 4" Name PachiPachi3-4 AfterImage 0 Color "none none 10" Next "PachiPachi3-End-1 7.0 4 PachiPachi3-End-2 7.0 4" Name PachiPachi3-5 AfterImage 0 Color "none none 12" Next "PachiPachi3-End-1 7.0 4 PachiPachi3-End-2 7.0 4" Name PachiPachi3-6 AfterImage 0 Color "none none 14" Next "PachiPachi3-End-3 7.0 4 PachiPachi3-End-4 7.0 4" Name PachiPachi3-7 AfterImage 0 Color "none none 16" Next "PachiPachi3-End-3 7.0 4 PachiPachi3-End-4 7.0 4" Name PachiPachi3-8 AfterImage 0 Color "none none 18" Next "PachiPachi3-End-3 7.0 4 PachiPachi3-End-4 7.0 4" Name PachiPachi3-9 AfterImage 0 Color "none none 20" Next "PachiPachi3-End-3 7.0 4 PachiPachi3-End-4 7.0 4" Name PachiPachi3-End-1 AfterImage 2 Color "white pink 5 pink pink 3 none none 5 brown brown 3 none none 5" Color "green none 20" Name PachiPachi3-End-2 AfterImage 2 Color "white none 5 none none 5 green green 3 none none 5 yellow yellow 3" Color "none none 5 cyan none 20" Name PachiPachi3-End-3 AfterImage 2 Color "white blue 5 blue blue 3 none none 5 magenta magenta 3 none none 5" Color "purple none 20" Name PachiPachi3-End-4 AfterImage 2 Color "white none 5 none none 5 orange orange 3 none none 5 red red 3" Color "none none 5 cyan none 20" #------------------------------------------------------------------------------ # Pachi Pachi 4 #------------------------------------------------------------------------------ Name PachiPachi4 Probability Default Next "PachiPachi4-1 10 3" Next "PachiPachi4-2 10 3" Next "PachiPachi4-3 10 3" Next "PachiPachi4-4 10 3" Next "PachiPachi4-5 10 3" Next "PachiPachi4-6 10 3" Next "PachiPachi4-7 10 3" Next "PachiPachi4-8 10 3" Next "PachiPachi4-9 10 3" Name PachiPachi4-1 AfterImage 0 Color "none none 4" Next "PachiPachi4-End-1 7.0 4 PachiPachi4-End-2 7.0 4" Name PachiPachi4-2 AfterImage 0 Color "none none 8" Next "PachiPachi4-End-1 7.0 4 PachiPachi4-End-2 7.0 4" Name PachiPachi4-3 AfterImage 0 Color "none none 12" Next "PachiPachi4-End-1 7.0 4 PachiPachi4-End-2 7.0 4" Name PachiPachi4-4 AfterImage 0 Color "none none 16" Next "PachiPachi4-End-3 7.0 4 PachiPachi4-End-4 7.0 4" Name PachiPachi4-5 AfterImage 0 Color "none none 20" Next "PachiPachi4-End-3 7.0 4 PachiPachi4-End-4 7.0 4" Name PachiPachi4-6 AfterImage 0 Color "none none 24" Next "PachiPachi4-End-3 7.0 4 PachiPachi4-End-4 7.0 4" Name PachiPachi4-7 AfterImage 0 Color "none none 28" Next "PachiPachi4-End-3 7.0 4 PachiPachi4-End-4 7.0 4" Name PachiPachi4-8 AfterImage 0 Color "none none 32" Next "PachiPachi4-End-3 7.0 4 PachiPachi4-End-4 7.0 4" Name PachiPachi4-9 AfterImage 0 Color "none none 36" Next "PachiPachi4-End-3 7.0 4 PachiPachi4-End-4 7.0 4" Name PachiPachi4-End-1 AfterImage 2 Color "white red 5 red red 3 none none 3 red red 3 none none 3" Color "red red 3 none none 3 red red 3 none none 3" Name PachiPachi4-End-2 AfterImage 2 Color "white blue 5 blue blue 3 none none 3 blue blue 3 none none 3" Color "blue blue 3 none none 3 blue blue 3 none none 3" Name PachiPachi4-End-3 AfterImage 2 Color "white green 5 green green 3 none none 3 green green 3 none none 3" Color "green green 3 none none 3 green green 3 none none 3" Name PachiPachi4-End-4 AfterImage 2 Color "white cyan 5 cyan cyan 3 none none 3 cyan cyan 3 none none 3" Color "cyan cyan 3 none none 3 cyan cyan 3 none none 3" ############################################################################### # Renzoku ############################################################################### Name Renzoku1 Probability Default Next "Renzoku1-A 8 1 Renzoku1-B 8 1 Renzoku1-C 8 1 Renzoku1-D 8 1" Next "Renzoku1-E 8 1 Renzoku1-F 8 1 Renzoku1-G 8 1 Renzoku1-H 8 1" Next "Renzoku1-I 8 1 Renzoku1-J 8 1 Renzoku1-K 8 1 Renzoku1-L 8 1" Next "Renzoku1-M 8 1 Renzoku1-N 8 1 Renzoku1-O 8 1 Renzoku1-P 8 1" Name Renzoku1-A Gravity 0 Color "none none 0" Next "NormalChange5 8 20" Name Renzoku1-B Gravity 0 Color "none none 10" Next "NormalChange5 8 20" Name Renzoku1-C Gravity 0 Color "none none 20" Next "NormalChange5 8 20" Name Renzoku1-D Gravity 0 Color "none none 30" Next "NormalChange5 8 20" Name Renzoku1-E Gravity 0 Color "none none 40" Next "NormalChange5 8 20" Name Renzoku1-F Gravity 0 Color "none none 50" Next "NormalChange5 8 20" Name Renzoku1-G Gravity 0 Color "none none 60" Next "NormalChange5 8 20" Name Renzoku1-H Gravity 0 Color "none none 70" Next "NormalChange5 8 20" Name Renzoku1-I Gravity 0 Color "none none 80" Next "NormalChange5 8 20" Name Renzoku1-J Gravity 0 Color "none none 90" Next "NormalChange5 8 20" Name Renzoku1-K Gravity 0 Color "none none 100" Next "NormalChange5 8 20" Name Renzoku1-L Gravity 0 Color "none none 110" Next "NormalChange5 8 20" Name Renzoku1-M Gravity 0 Color "none none 120" Next "NormalChange5 8 20" Name Renzoku1-N Gravity 0 Color "none none 130" Next "NormalChange5 8 20" Name Renzoku1-O Gravity 0 Color "none none 140" Next "NormalChange5 8 20" Name Renzoku1-P Gravity 0 Color "none none 150" Next "NormalChange5 8 20" ############################################################################### # Edawakare ############################################################################### Name Edawakare1 Probability Default Next "Edawakare1-A 10 5" Name Edawakare1-A Transmission 100.0 Color "white red 5" Next "Edawakare1-End 3 3 Edawakare1-B 0 1" Name Edawakare1-B Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-C 0 1" Name Edawakare1-C Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-D 0 1" Name Edawakare1-D Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-E 0 1" Name Edawakare1-E Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-F 0 1" Name Edawakare1-F Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-G 0 1" Name Edawakare1-G Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-H 0 1" Name Edawakare1-H Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-I 0 1" Name Edawakare1-I Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-J 0 1" Name Edawakare1-J Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-K 0 1" Name Edawakare1-K Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-L 0 1" Name Edawakare1-L Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-M 0 1" Name Edawakare1-M Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-N 0 1" Name Edawakare1-N Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-O 0 1" Name Edawakare1-O Transmission 100.0 Color "red red 5" Next "Edawakare1-End 3 3 Edawakare1-P 0 1" Name Edawakare1-P Transmission 100.0 Color "red red 5" Next "NormalChange3 7 10" Name Edawakare1-End Transmission 100.0 Color "white yellow 5 yellow red 15 red blue 10 blue none 10" Name Edawakare2 Probability Default Next "Edawakare2-A 10 4" Name Edawakare2-A Transmission 100.0 AfterImage 20 Color "white red 5" Next "Edawakare2-End 3 2 Edawakare2-B 0 1" Name Edawakare2-B Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-C 0 1" Name Edawakare2-C Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-D 0 1" Name Edawakare2-D Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-E 0 1" Name Edawakare2-E Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-F 0 1" Name Edawakare2-F Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-G 0 1" Name Edawakare2-G Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-H 0 1" Name Edawakare2-H Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-I 0 1" Name Edawakare2-I Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-J 0 1" Name Edawakare2-J Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-K 0 1" Name Edawakare2-K Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-L 0 1" Name Edawakare2-L Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-M 0 1" Name Edawakare2-M Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-N 0 1" Name Edawakare2-N Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-O 0 1" Name Edawakare2-O Transmission 100.0 AfterImage 20 Color "red red 5" Next "Edawakare2-End 3 2 Edawakare2-P 0 1" Name Edawakare2-P Transmission 100.0 AfterImage 20 Color "red none 10" Name Edawakare2-End Transmission 100.0 AfterImage 20 Color "white yellow 5 yellow green 15 green red 10 red none 10" Name Edawakare3 Probability Default Next "Edawakare3-A 10 5" Name Edawakare3-A Color "white red 5 red green 15 green yellow 15" Next "Edawakare3-B 7 5" Name Edawakare3-B Color "white red 5 red cyan 15 cyan yellow 15" Next "Edawakare3-C1 7 3 Edawakare3-C2 7 3" Name Edawakare3-C1 Color "white red 5 red yellow 10 yellow yellow 10" Color "yellow red 10 red purple 10 purple none 10" Name Edawakare3-C2 Color "white red 5 red yellow 10 yellow yellow 10" Color "yellow cyan 10 cyan blue 10 blue none 10" ############################################################################### # End of File. ############################################################################### xfireworks-1.3.orig/arguments.c0100644000175000017500000000540507142030232015746 0ustar kmutokmuto#include "arguments.h" #include "etc.h" static void DeleteArgument(int * argc, char ** argv, int i) { (*argc)--; for (; i < (*argc); i++) argv[i] = argv[i + 1]; } static int CheckArguments(int * argc, char ** argv, char * s) { int i, r = 0; for (i = 1; i < *argc; i++) { if (!StringCmp(s, argv[i])) { DeleteArgument(argc, argv, i); r = 1; } } return (r); } static char * GetStringFromArguments(int * argc, char ** argv, char * s) { int i; char * p = (char *)NULL; for (i = 1; i < *argc; i++) { if (!StringCmp(s, argv[i])) { if (i == *argc - 1) { DeleteArgument(argc, argv, i); } else { DeleteArgument(argc, argv, i); p = argv[i]; DeleteArgument(argc, argv, i); } } } return (p); } int Arguments_Read(int * argc, char ** argv, Argument arguments[]) { int i; char * p; void (*funcp)(); int n = 0; for (i = 0; arguments[i].name != NULL; i++) { if (arguments[i].flag == ARGUMENTS_NONE) { /* None */ } else if (arguments[i].flag == ARGUMENTS_FUNCTION) { if (CheckArguments(argc, argv, arguments[i].name)) { funcp = (void (*)())(arguments[i].value); (*funcp)(); n++; } } else if (arguments[i].flag == ARGUMENTS_FLAG) { if ((p = GetStringFromArguments(argc,argv,arguments[i].name)) != NULL) { if ( (!StringCmp(p, "off")) || (!StringCmp(p, "OFF")) ) { *((short int *)(arguments[i].value)) = ARGUMENTS_FALSE; n++; } else if ( (!StringCmp(p, "on" )) || (!StringCmp(p, "ON" )) ) { *((short int *)(arguments[i].value)) = ARGUMENTS_TRUE; n++; } } } else if (arguments[i].flag == ARGUMENTS_FLAG_ON) { if (CheckArguments(argc, argv, arguments[i].name)) { *((short int *)(arguments[i].value)) = ARGUMENTS_TRUE; n++; } } else if (arguments[i].flag == ARGUMENTS_FLAG_OFF) { if (CheckArguments(argc, argv, arguments[i].name)) { *((short int *)(arguments[i].value)) = ARGUMENTS_FALSE; n++; } } else if (arguments[i].flag == ARGUMENTS_INTEGER) { if ((p=GetStringFromArguments(argc, argv, arguments[i].name)) != NULL) { *((int *)(arguments[i].value)) = atoi(p); n++; } } else if (arguments[i].flag == ARGUMENTS_STRING) { if ((p=GetStringFromArguments(argc, argv, arguments[i].name)) != NULL) { *((char **)(arguments[i].value)) = p; n++; } } } while (*argc > 1) { fprintf(stderr, "ERROR : Unknown Argument : %s\n", argv[1]); DeleteArgument(argc, argv, 1); } return (n); } /*****************************************************************************/ /* End of Program. */ /*****************************************************************************/ xfireworks-1.3.orig/arguments.h0100644000175000017500000000175707142030233015762 0ustar kmutokmuto/*****************************************************************************/ /* 実行時のコマンドラインオプションの読み込み用のライブラリ */ /*****************************************************************************/ #ifndef _Arguments_h_INCLUDED_ #define _Arguments_h_INCLUDED_ #include #include #define ARGUMENTS_NONE 0 #define ARGUMENTS_FLAG 1 #define ARGUMENTS_FLAG_ON 2 #define ARGUMENTS_FLAG_OFF 3 #define ARGUMENTS_INTEGER 4 #define ARGUMENTS_STRING 5 #define ARGUMENTS_FUNCTION 6 #define ARGUMENTS_TRUE 1 #define ARGUMENTS_FALSE 0 typedef struct _Argument { char * name; short int flag; void * value; } Argument; /*===========================================================================*/ /* コマンドラインオプションの読み込み(戻り値は処理したオプションの数) */ /*===========================================================================*/ int Arguments_Read(int * argc, char ** argv, Argument arguments[]); #endif xfireworks-1.3.orig/Disp.c0100644000175000017500000001454607142030232014646 0ustar kmutokmuto#include "DispP.h" #include "etc.h" Display * Disp_GetDisplay(Disp disp) { return (disp->display); } Colormap Disp_GetColormap(Disp disp) { return (disp->colormap); } int Disp_GetWidth( Disp disp) { return (disp->width ); } int Disp_GetHeight(Disp disp) { return (disp->height); } /*===========================================================================*/ /* 色の取得 */ /*===========================================================================*/ unsigned long Disp_GetPixel(Disp disp, char * color_name) { XColor c0, c1; XAllocNamedColor(disp->display, disp->colormap, color_name, &c0, &c1); return (c0.pixel); } /*===========================================================================*/ /* GC の作成と解放 */ /*===========================================================================*/ GC Disp_CreateGC(Disp disp) { GC gc; gc = XCreateGC(disp->display, disp->root_window, 0, 0); return (gc); } int Disp_DestroyGC(Disp disp, GC gc) { XFreeGC(disp->display, gc); return (0); } /*===========================================================================*/ /* オブジェクトの生成と削除 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ Disp Disp_Create(char * display_name, int direct_draw) { Disp disp; unsigned long int pixel; disp = (Disp)malloc(sizeof(_Disp)); if (!disp) Error("Disp_Create", "Cannot allocate memory."); disp->display = XOpenDisplay(display_name); if (disp->display == NULL) Error("Disp_Create", "Cannot open display."); disp->screen = DefaultScreen(disp->display); disp->root_window = RootWindow(disp->display, disp->screen); disp->colormap = DefaultColormap(disp->display, disp->screen); disp->width = DisplayWidth( disp->display, disp->screen); disp->height = DisplayHeight(disp->display, disp->screen); disp->depth = DefaultDepth(disp->display, disp->screen); disp->direct_draw = direct_draw; if (disp->direct_draw) { disp->pixmap = NULL; } else { disp->pixmap = XCreatePixmap(disp->display, disp->root_window, disp->width, disp->height, disp->depth); } return (disp); } /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ Disp Disp_Destroy(Disp disp) { if (!disp) return (NULL); if (disp->pixmap) XFreePixmap(disp->display, disp->pixmap); if (disp->display) XCloseDisplay(disp->display); free(disp); return (NULL); } /*---------------------------------------------------------------------------*/ /* フラッシュ */ /*---------------------------------------------------------------------------*/ int Disp_Flush(Disp disp) { XEvent ev; if (!disp->direct_draw) { #if 0 XSetWindowBackgroundPixmap(disp->display, disp->root_window, disp->pixmap); #endif XClearWindow(disp->display, disp->root_window); } /* イベントのフラッシュ */ while (XPending(disp->display)) { XNextEvent(disp->display, &ev); } XFlush(disp->display); return (0); } /*---------------------------------------------------------------------------*/ /* X サーバとの Sync.(イベントキューを廃棄する) */ /*---------------------------------------------------------------------------*/ int Disp_Sync(Disp disp) { Disp_Flush(disp); /* リクエストのフラッシュ */ #if 1 XSync(disp->display, True); /* イベントキュー内のイベントを廃棄する */ #else XSync(disp->display, False); /* イベントキュー内のイベントを廃棄しない */ #endif return (0); } /*---------------------------------------------------------------------------*/ /* ピックスマップのクリア */ /*---------------------------------------------------------------------------*/ int Disp_ClearPixmap(Disp disp, GC gc) { if (disp->pixmap) XFillRectangle(disp->display, disp->pixmap, gc, 0, 0, disp->width, disp->height); return (0); } /*---------------------------------------------------------------------------*/ /* ディスプレイのクリア */ /*---------------------------------------------------------------------------*/ int Disp_ClearDisplay(Disp disp, unsigned long pixel) { if (disp->direct_draw) { XSetWindowBackground(disp->display, disp->root_window, pixel); } else { XSetWindowBackgroundPixmap(disp->display, disp->root_window, disp->pixmap); } XClearWindow(disp->display, disp->root_window); Disp_Flush(disp); return (0); } /*---------------------------------------------------------------------------*/ /* 円の描画 */ /*---------------------------------------------------------------------------*/ int Disp_DrawFilledCircle(Disp disp, GC gc, int x, int y, int r) { if (x + r < 0 || disp->width - 1 < x - r || y + r < 0 || disp->height - 1 < y - r) return (0); if (disp->direct_draw) XFillArc(disp->display, disp->root_window, gc, x - r, y - r, r * 2 + 1, r * 2 + 1, 0, 360 * 64); else XFillArc(disp->display, disp->pixmap, gc, x - r, y - r, r * 2 + 1, r * 2 + 1, 0, 360 * 64); return (0); } int Disp_DrawFilledCircles(Disp disp, GC gc, XArc * arcs, int n) { if (n > 0) { if (disp->direct_draw) XFillArcs(disp->display, disp->root_window, gc, arcs, n); else XFillArcs(disp->display, disp->pixmap, gc, arcs, n); } return (0); } /*****************************************************************************/ /* ここまで */ /*****************************************************************************/ /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/Disp.h0100644000175000017500000000726007142030233014647 0ustar kmutokmuto#ifndef _XFIREWORKS_Disp_h_INCLUDED_ #define _XFIREWORKS_Disp_h_INCLUDED_ typedef struct _Disp * Disp; /* Disp クラスの定義 */ #include Display * Disp_GetDisplay(Disp disp); Window Disp_GetWindow(Disp disp); Colormap Disp_GetColormap(Disp disp); int Disp_GetWidth( Disp disp); int Disp_GetHeight(Disp disp); /*===========================================================================*/ /* 色の取得 */ /*===========================================================================*/ unsigned long Disp_GetPixel(Disp disp, char * color_name); /*===========================================================================*/ /* GC の作成と解放 */ /*===========================================================================*/ GC Disp_CreateGC(Disp disp); int Disp_DestroyGC(Disp disp, GC gc); /*===========================================================================*/ /* オブジェクトの生成と削除 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ Disp Disp_Create(char * display_name, int direct_draw); /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ Disp Disp_Destroy(Disp disp); /*---------------------------------------------------------------------------*/ /* フラッシュ */ /*---------------------------------------------------------------------------*/ int Disp_Flush(Disp disp); /*---------------------------------------------------------------------------*/ /* X サーバとの Sync.(イベントキューを廃棄する) */ /*---------------------------------------------------------------------------*/ int Disp_Sync(Disp disp); /*---------------------------------------------------------------------------*/ /* ピックスマップのクリア */ /*---------------------------------------------------------------------------*/ int Disp_ClearPixmap(Disp disp, GC gc); /*---------------------------------------------------------------------------*/ /* ディスプレイのクリア */ /*---------------------------------------------------------------------------*/ int Disp_ClearDisplay(Disp disp, unsigned long pixel); /*---------------------------------------------------------------------------*/ /* 円の描画 */ /*---------------------------------------------------------------------------*/ int Disp_DrawFilledCircle(Disp disp, GC gc, int x, int y, int r); int Disp_DrawFilledCircles(Disp disp, GC gc, XArc * arcs, int n); /*****************************************************************************/ /* ここまで */ /*****************************************************************************/ #endif /* _XFIREWORKS_Disp_h_INCLUDED_ */ /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/README0100644000175000017500000001351607142030233014460 0ustar kmutokmutoXFireworks - fireworks on X. SYNOPSIS xfireworks [options] DESCRIPTION XFireworks makes fireworks in the root window on X. This is imitation of Japanese "Hanabi Taikai". It is very popular event in Japanese summer and performed on some rivers. Sumidagawa River's Hanabi Taikai is very popular. The author has seen Arakawa River's Hanabi Taikai every year. OPTIONS -h, -help Output help messages. -display [displayname] The name of the X server to use. -bg, -background, -background-color [color name] Background color of the root window. -f, -file [filename] The name of the file to configure fireworks. Default configure file is ./xfireworks.conf -wait [wait time] Wait time for micro seconds. -fine [number] Steps of moving pieces of fireworks for percent. Default value is 100. If this value is small, xfireworks runs quickly and speedy. -gradation [number] Color gradation. Default value is 16. If color gradation is a little, colors are shared, memory of X server and xfireworks are saved, and xfireworks starts up quickly. -direct-draw XFireworks draw fireworks in the root window directly. (Default) -no-direct-draw XFireworks draw fireworks in a pixmap and copy it to the root window as a background pixmap. If xfireworks don't run properly or you want to run XFireworks as a background pixmap, try this option. -probability, -probability-magnification [number] Magnification of probability of performing fireworks for percent. Default value is 100. If this value is small, fireworks is very silent. If this value is large, fireworks is very loud. -size, -size-magnification [number] Magnification of size of pieces for percent. Default value is 100. -air, -air-magnification [number] Magnification of air resistance for percent. Default value is 100. -gravity, -gravity-magnification [number] Magnification of gravity for percent. Default value is 100. -transmission, -transmission-magnification [number] Magnification of velocity transmission for percent. Default value is 100. -after-image, -after-image-magnification [number] Magnification of after images length for percent. Default value is 100. If this value is large, length of after images is very long. -color-length, -color-length-magnification [number] Magnification of color change length for percent. Default value is 100. -next-power, -next-power-magnification [number] Magnification of pieces explosion power for percent. Default value is 100. -next-number, -next-number-magnification [number] Magnification of the number of pieces for percent. Default value is 100. If this value is small, fireworks is very silent. If this value is large, fireworks is very loud. EXAMPLES If your machine is very slow, try > xfireworks -fine 75 -after-image 75 If your machine has less colors, try > xfireworks -gradation 5 XFireworks use 5x5x5=125 colors. If you have very high spec machine, try > xfireworks -fine 200 -after-image 150 -gradation 64 -wait 10000 If you like simple fireworks (it's Japanese "Wabi Sabi"), try > xfireworks -probability 50 If you like loud fireworks, try > xfireworks -probability 500 -after-image 200 -next-number 120 If xfireworks don't run properly, try > xfireworks -direct-draw or > xfireworks -no-direct-draw FILES ./xfireworks.conf /lib/X11/XFireworks/xfireworks.conf The default file to configure XFireworks. XFireworks search the configuration file in the current directry at first. If not exist, second, XFireworks search "/lib/X11/XFireworks". If not exist, XFireworks use the default data in itself at last. You can get the newest xfireworks.conf from the web page of XFireworks. The newest xfireworks.conf has more kinds of fireworks and is more beautiful. Q AND A Q. All of fireworks are white. A. Your machine have less colors. Use -gradation option and decrease the number of colors to use. Q. If I use gmc (GNOME file manager), xfireworks runs very slow. A. Try -no-direct-draw option. Q. I want to put fireworks on the root window as a background picture. But, if I stop xfireworks with Ctrl-C, the root window is cleaned. A. Try -no-direct-draw option. If you run xfireworks with -no-direct-draw option, xfireworks don't clean the root window when you stop xfireworks. Q. If I use xfireworks with -fine 500 -after-image 500 options, movements of fireworks are not smoothly. A. Try -no-direct-draw option. If you run xfireworks with -no-direct-draw option, xfireworks draw fireworks on a pixmap and copy it to the root window, and movements of fireworks are smoothly. Q. I want to see more beautiful fireworks! A. Access the XFireworks's web page and download the newest xfireworks.conf. Q. I want to make my original fireworks! A. Edit xfireworks.conf. If you make more beautiful fireworks, please send it to the author. AUTHOR Programed by SAKAI Hiroaki. E-Mail: sakai@seki.ee.kagu.sut.ac.jp, hsakai@pfu.co.jp Web site: http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/index.html Mirror site: http://hp.vector.co.jp/authors/VA014157/myfreesoft/index.html http://www.people.or.jp/~hsakai/myfreesoft/index.html If you want the newest xfireworks.conf, access these web pages. SPECIAL THANKS Hashimoto Jun for many advices and test on Linux. Simosako Akira for test on Linux and many informations. Koga Kazuhiro for test on Linux. Umehara Taro for test on FreeBSD. Morimi Asuka for many advices. COPYRIGHT XFireworks Copyright (c) 2000 SAKAI Hiroaki. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. xfireworks-1.3.orig/ObjP.h0100644000175000017500000000172607142030233014603 0ustar kmutokmuto/*****************************************************************************/ /* ObjP.h - A library for object list. */ /* */ /* ObjP.h Copyright (c) 2000 Sakai Hiroaki. */ /* All Rights Reserved. */ /*****************************************************************************/ #ifndef _SAKAILIB_OBJP_H_INCLUDED_ #define _SAKAILIB_OBJP_H_INCLUDED_ #include "Obj.h" /* データ格納用構造体 */ typedef struct _ObjListData { struct _ObjListData * prev; /* 前のデータ */ struct _ObjListData * next; /* 次のデータ */ Obj obj; /* オブジェクト */ Obj (*destructor)(Obj); /* 削除時に呼ばれるデストラクタ */ } _ObjListData; /* リスト構造の管理用 */ typedef struct _ObjList { struct _ObjListData * start_edge; struct _ObjListData * end_edge; int length; } _ObjList; #endif xfireworks-1.3.orig/mkconf.c0100644000175000017500000000136107142030233015214 0ustar kmutokmuto#include #include #if 1 #define ONE_LINE #endif main() { char buffer[1000]; char * p; printf("static char * default_xfireworks_conf =\n"); #ifdef ONE_LINE printf("\""); #endif while (fgets(buffer, 1000, stdin) != NULL) { if ((buffer[0] != '\0') && (buffer[0] != '#')) { #ifndef ONE_LINE printf("\""); #endif for (p = buffer; *p != '\0'; p++) { if (*p == '\n') break; else if (*p == '\t') printf(" "); else if (*p == '\"') printf("\\\""); else if (*p == '\'') printf("\\\'"); else printf("%c", *p); } #ifdef ONE_LINE printf("\\n"); #else printf("\\n\"\n"); #endif } } #ifdef ONE_LINE printf("\";\n"); #else printf(";\n"); #endif exit (0); } /* End of Program */ xfireworks-1.3.orig/OMAKE.jpn0100644000175000017500000006606407142030233015153 0ustar kmutokmutoこの文書は,おまけ,ていうか,暇なときに気が向いたまま書き貯めたものです. ■■ N.A.D.A.R. 開発秘話 N.A.D.A.R. は,そもそもは中学生のときに,「TANK」という名前で作った, 2人対戦のゲームだった.もう10年以上前の話だ. もともとぼくは戦車ゲームが好きなのだが,まわりにはあまり満足のいく 戦車ゲームが無かった.そこで昔のプログラマの鉄則, ほしければ作る にしたがって,自宅の PC-9801VX で作ったのがはじまりだった. このころ学校の理科室に PC-9801M2 があって,それでプレイしてたりしてた. しかし当時の PC-9801M2 はすでにひと昔前の機種であり,8086 の 5MHz では 名機 PC-9801VX の 80286 8MHz にはかなうはずもなく, おそすぎてゲームにならん とフトドキなことを考えていた.とくに接近戦になって,2人が同時に 砲弾とミサイルを撃つと,目に見えて速度が低下してしまう.しかしこれも, クライマックスでスローモーションになる,映画のワンシーンみたい とあるていど納得していたわけであるから, 遅延まで考慮に入れて逆に利用したゲーム という,今思うとカッコイイ仕様ではあったと思う.(本当か!?) TANK は一人プレイ用の TANK2,2人プレイ用になって,TANK3A, 改良を加えて,TANK3B, TANK3C, ... と製作していき,最終的には, TANK3E まで製作した. その後,兄の「戦車をもっと大きくしたほうがよい」という意見を採り入れて, 戦車を拡大した TANK3F,再びもとに戻した TANK3G というように, 暇をみてはバージョンアップしていく という,まさに趣味で作ってるプログラムであった. 大学3年生から4年生にかけて, マイコン BASIC MAGAZINE によく投稿していて,一時期,常連になっていたのだが, 大学4年のときに,マイコン BASIC MAGAZINE の投稿用に,プログラムを 全体的に見直して,TANK3I を作った.が,これは, あえなくボツ マイコン BASIC MAGAZINE の掲載基準は「アイディア重視」であって, やはりこういうありがちなゲームは載りにくい.しかも2人でないと プレイできないとなると,なおさら載りにくい. ピーピング形式にして,TANK3J を作ったが, これもボツ PC-9801 用の TANK は,ここまでである. しかし,研究室に入って,X を使うようになってからは,いつか TANK を X に移植したいと思っていた.そして, フリーソフトとして公開する という,Tank 復活の方法を考えていた. 実際に Tank を書きはじめたのは,就職した1999年の4月からである. 4月に就職し,5月くらいから,Tank で使用するためのネットワーク通信用 ライブラリを書き出した. このころ,ちょうど, オブジェクト指向 にはまってて,頭の中ではすっかりオブジェクト指向至上主義. オブジェクト指向で書いておけば, その向こうにはバラ色の世界が待っている という考えだった. しかし,通信には文字列処理がつきものなので,そのまえに文字列処理用の String クラスを作ろう,と思った. また,通信するには select() で調べることが必要になるから,select() 用の クラスも欲しい.ソケットの接続までの部分は接続部分として,別クラスにしたい. 通信は文字列の通信を行う部分と,じっさいにデータ通信を行う部分は別クラスに したい,などという感じで,オブジェクト指向をやりたてのときにありがちな, なんでもかんでもクラスにしよう というようにはまってしまい,あげくのはてには, 整数までも,Integer クラスで管理しそうな勢い になって,収拾がつかなくなってしまう. また,クライアントが複数になったときには,サーバ側では fork() して通信の 接続要求だけを処理するようなプロセスを作って,クライアントごとには 通信だけを処理するプロセスを作り,サーバプロセスとはパイプで通信する... というような実装も見越した上で書きたい,などと, はてしない深みにはまっていってしまった そのうち EyeClock-2.0 の開発を始めることになってしまい,こっちに どっぷりつかってしまった. 1999年の8月から12月にかけては,EyeClock-2.0 にかかりっきりで, Tank は先送り(ていうか,ほとんど忘れ去られた状態)になってしまった. EyeClock-2.0 は1999年の年末ぎりぎり(クリスマスイブだった. とくに意味はないのだが)に公開した.しかし今思えば, クリスマスイブに,世のため人のために フリーソフトを公開しているなんて, 聖人のような生活 だと思ってしまう. しかし,ただの時計なので, たいして世のためになっていない というのが悲しいところである. EyeClock-2.0 がひと段落してからは,あそびで XKeyWrap とかを書いていたのだが, 2000年の1月中旬くらいにようやく Tank を書き出した. 以前の教訓があったので,今回はあまり細部にこだわらずに, とりあえず動くもんをつくって公開しちまえ という方針で開発を進めた. 以前のネットワーク用ライブラリとか,EyeClock-2.0 での経験とかが あったので,開発はトントン拍子に進んで,わずか1ヵ月足らずで ふつうにプレイできるプロトタイプが仕上がった. よく,「N.A.D.A.R.って,なんの略なの?」と聞かれる. N.A.D.A.R. の命名には,ずいぶん悩んだ.ここで,命名の由来を書こう. もともと橋本も僕も, グロブダー というゲームが好きだった.ナムコのずいぶん古いアーケードゲームなのだが, ちょっとでも気を抜いたら(ていうか,気を抜いていなくても),あっと言うまに やられてしまうという,スリルとスピード感のあるゲームだった. やはりスリルと緊張感,一瞬の判断こそが アクションゲームの醍醐味 だとぼくは思っているので,そんなゲームを作りたいと常々思っていた. N.A.D.A.R. のプロトタイプが完成して,そろそろ名前を決めてしまいたいと いうとき,橋本と焼肉屋に行った.で,焼肉屋でいろいろ話したのだが,とりあえず, 「TANK」はやめよう ということになった. 戦車の重みを表現したいので,「グロブダー」のように,濁音のある名前にしたい. そう考えると,「グロブダー」は,G,B,D と,濁音のある文字が3つも入っている. そこで考えたのが, GNOMEDAR でも,GNOME は直接的にとくに関係は無いのでこれは却下. いっそのこと,日本的な名前はどうだろう? 「風林火山」 なんて冗談半分でいろいろ考えていたのだが,そこでそのとき, 「灘の生一本」 という日本酒のポスターが目に入った. 「灘」ってのはどうだ? このときは,あまり深く考えてなくって,けっきょくこの日には決まらなかった のだが,このときにしっかり決めなかったのがよくなかった. そのうち開発を進めるうちに,ファイル名とかも整理しだして, ほんとにもういいかげん名前を決めたい と思い,けっきょく,「灘」にアクセントで r をつけて,「NADAR」にしてしまった. というように,あまり意味なく決まってしまった「NADAR」なのだが, 作者としては,いちおう, アルファベットになにか意味を持たせたい うーん, N.A.D.A.R. - Network Action ... だめだ,Dのあたりでなんにもおもいつかん. ■■ EyeClock 開発秘話 そもそもなんで EyeClock を作り出したかってはなし. 大学の卒業研究のために研究室に配属されたのは,1996年の3月だった. この研究室では数値計算を行うため,メインの OS として UNIX が使われていた のだが,僕にとっては,これが,よかった. 研究室では主に FreeBSD を使って作業していたんだけれど, 「好きな画像を時計にしたい!」 と,常々思っていた. 今思えば,よく探せばそういう時計アプリケーションもなにかしらあるんじゃ ないかと思うんだけど,そのときはよく探しもせずに,man xclock をてきとーに 読んだくらいであきらめていた. これが後々 EyeClock の開発につながったわけだ. EyeClock の開発に着手したのは,たしか,1998 年の6月ごろだったと思う. 1998年の5月というと,自分は大学院の修士2年で,就職活動のあいまを 見つけては,本業の研究をそっちのけにして, XMangekyou を書いていた. なにせこのころは,毎日毎日,一日中 X のプログラミングをしてたのだ. 毎週火曜と水曜には研究室に泊まって,大学の近くの 三河屋という酒屋(理科大の人はよく知っているハズだ) に行って,ビールとワインを買って,夜になると, 飲んで歌いながら プログラミングをしていたもんだ.(今考えると,不気味だ) 研究室にはスパゲッティとミートソースの缶詰を買い置き(これも三河屋で買ったもの) してあって,だいたい夜の12時を過ぎたころに,夜食を食べて,で, 明け方の4時頃までがんばって,眠くてどうしようもなくなったら,寝袋で寝る. 朝は10時頃に起きて,大学のトレーニングルームでシャワーを浴びて, シャンプーして,ヒゲをそって,で,またプログラミングを始める, といった生活だった. このため,研究室には, 着替えも常備してあった このころまでは,だれも使っていなかった Sun SPARC Station 5 をよく 使っていたんだけれど,XMangekyou の動作を XFree86 上でテストする 必要性が出てきたので,これまたあまりだれも使っていなかった,ロースペックの オーダーメイド AT 互換機(FreeBSD + XFree86) を使うようになった. このロースペックマシンは,研究室に数少ない, 音の出るマシン のうちのひとつだったので,けっこうお気に入りだった.ロースペックなので, だれも使わないし,計算を走らせたりもしないから,気軽に使えるということもあり, けっきょく,卒業するまで,ずっとこのマシンを使っていた. EyeClock や XStarRoll や修士論文は,すべてこのマシンを使って書いた. 5月の中旬に就職が決まって,そのあとには,たまに研究もしつつ, でも本業はプログラミングというくらいのいきおいで,プログラミングをしていた. 当時の後輩曰く, 「坂井さんはいっつも研究室にいるけど, なにをやっているのかわからんです」 研究してるわけでもないし,遊んでいるようにも見えないし,ということだった らしい.とはいっても, じつは遊んでいたんだけどね 5月の終り頃,XMangekyou をひととおり作り終えたあとは,いよいよ EyeClock の 開発にとりかかる. まず,時計「MyClock」を作った.これは,時計とはいっても, 白黒のビットマップを張りつけられるだけ という,非常におそまつなものだった.当時はまだピックスマップファイルの 読み込みかたをしらなかったので,しかたなくビットマップで作ったのだ. このあたりの作業の順番はじつはうろおぼえなので,たしかなことはよく 覚えていないのだが,次にやったのは, 「ピックスマップファイルを読み込んで,カラーで表示したい!」 ということだったとおもう. しかし,X の標準では,ピックスマップファイルを読み込んでピックスマップを 作成するような関数は,提供されていない. X や Motif の書籍をいろいろ調べたのだが,ピックスマップファイルの 読み込みかたは,書いていなかった.そこで,かの有名な, EmiClock のソースを参考にすることにした. EmiClock のソースを読んで,はじめて Xpm ライブラリの存在を知り, ピックスマップファイルを読み込むことができるようになった. ちなみに EmiClock はすばらしく優れたプログラムで,ソースを見ると わかるのだが,ほんとにいたれりつくせりで, X のプログラミングをしようとしてるひとは,ぜひ読んだほうがいい という,おすすめの1本である. これで MyClock は,カラーの画像が扱えるようになった.自分としては それなりに満足して,タレントの画像を張り付けたりして使っていた. そんなある日,忘れもしない,帰宅中の 三田線水道橋〜白山 あたりで,ふと思った. 「あれで目を動かしたら,面白いんじゃないか?」 ここから EyeClock の開発が始まったわけだ. (次回作の OMAKE.jpn に続く) ■■ 趣味のプログラム ぼくは子供のころから,なにかものを作ることが趣味だったんだけど, ある日,ぼくの兄上(こいつもなにかものを作ることが趣味なのだが)と, ぼくと,父親で, よくわからない展示会 のようなところに行った.(なんの展示会だったのか,会場はどこだったのかなどは, まったく覚えていない) この展示会場には,当時はやりだった LED のゲームとかがいろいろあったように 記憶しているのだが,この会場のある一角に, マイコン が置いてあるコーナーがあった.(もともとは兄がそっちが目的だったらしいのだが) このマイコンは,RETURN キーが緑色と赤色だったので,いま思えばおそらく, 東芝のパソピア7だったのだろうとおもう. このマイコンでは,実際に BASIC のプログラムをいろいろいじる,というような デモが行われていたらしく, BASIC のプログラムリストが画面上にダンプされていて, カーソルが左上で点滅しているだけ だった.ちなみに,この「マイコン」を初めて見て,ぼくが最初に口にした言葉は, 「ねえねえ,これってどんなゲームなの?」 だった.うーん,はずかしい. しばらくして,近所のひとがパソコンを持っているというので, 兄といっしょに触らせてもらいに行くことになった. このときあったのは,いま思えばたしか Sharp の MZ 系のマシンだったと思う. 当時はぼくはパソコンというものをまったく知らなかったので,ただ単に 兄についていって,兄がいじるのをとなりで見ていただけだったのだ. 兄がプログラムを打ち込み終って run すると,画面上に, 2 とかの数字が出てきた. もういちど run すると,今度は, 6 とかの数字が出てきた. 兄「これ,見てみ」 僕「なに,これ?」 そう,このとき兄が書いていたプログラムは,忘れもしない, サイコロ であったのである. いま思えば, 10 A=INT(RND(1)*6)+1 20 PRINT A 30 END のようなプログラムを打ち込むのに,10数分かかっていたのだろう. そんな兄の要望で,ついに我が家もパソコンを買うことになった. 当時兄は小学6年生で,毎週秋葉原に行っては抵抗やコンデンサを買いこんできて, ラジオとかを作っていた(気違い小学生だ)のだが,そんなある日の日曜に, 父親,兄,僕で,いよいよ秋葉原に買いに行った. 秋葉原駅前のサトームセン(エスカレーターから外が見える建物)で選んだ パソコンは,忘れもしない, PC-8001mkII であった.たしか当時で本体価格が127,000円(だと思った)で,さらに当時はまだ 高価だったカラーディスプレイ(当時はまだ,グリーンディスプレイが主流だった) とデータレコーダーも買ったわけだから,当時の小学生にしては, けっこう高い買物だったとおもう. これのおかげで今があるわけだから,親には感謝感謝である. このときついでに, 2001年宇宙の旅 というゲームと,あと, ファイヤーレスキュー というゲームも買った.このファイヤーレスキューというのは,当時, マイコンショップの店頭で,デモなどによく使われていた記憶があるのだが, 内容はというと, 消防車を左右に操作して,スペースを押すとハシゴが伸びて, ビルの火事から人を救助する という,非常に単純なゲームだった.しかも,画面構成は, キャラクタベース だったのである. ____ | | /\__/ /\/ /\/ /\/ /\/ _/\/__________ | | | | \ | | | |__\ | | | | |__/ \____/ \___| \_/ \_/ というような消防車を動かすわけである. どちらも BASIC で書いてあって,ゲーム中に Stop を押すと, ^C Break in 1130 とかいって止まってしまって,なんと, プログラムリストを見ることができる という,いまから考えると信じられないようなものだった. ぼくが小4の6月に,ついに我が家にもパソコンが来た.このころは, パソコンが使える = BASIC でプログラムが書ける という時代だったので,ぼくもプログラムを書きはじめることになるのだが, はじめて買ったパソコンの本は, BASICプログラミング という本だった.(漫画である) どういう内容の本かというと, ロムさんとラムさん という兄弟が, マイコさんやアイコさん のために,家計簿だとか,社員の定期券の期限の計算用プログラムとかの プログラミングをしていく,という内容だった. ちなみにアイコさんはマイコさんの妹で,アイコさんはショートカットの OL で, ロムさんはマイコさんが好きで,ラムさんはアイコさんが好き,という設定だった. しかし, 今思うと,すごい名前だ ちなみにぼくは,長女系のマイコさんより,次女系のアイコさんのほうが好きだった. この本は BASIC をあるていど知っていることを前提にしていて, 実際にプログラムを書いていく,という内容だったので,まったくの初心者の ぼくには,よくわからなかった. そこで次に買った本が, まんがパソコンゼミナール(きぎようへい・さとう光) この本は,なんと,いまだに自宅に保存してある. どういう本かというと, マイちゃんとコンちゃん が,名機 PC-8001 を使って,「先生」と「ネコちゃん」といっしょに, コンピュータの仕組みや,プログラムの書き方を勉強していく,という内容だった. この本はとてもわかりやすくて, データバスやアドレスバスやコントロールバスや ROM や RAM や モニタプログラムや BASIC インタプリタや入力装置や出力装置や 入出力装置や機械語 といった,ハードのこともちゃんと解説されていて,とってもためになった. この本は,ボロボロになるまで,100回以上繰り返し読んでいると思う. この本の最後を飾っていたプログラムは,「センスイカンノエ」というものである. どういうものかというと,たしか, 10 REM センスイカンノエ 20 PRINT CHR$(12) 30 LOCATE 20,10 40 PRINT "センスイカンノエ" 50 FOR I=0 TO 1000 60 NEXT 70 PRINT CHR$(12) 80 LOCATE 0,10 90 PRINT " ■ " 100 PRINT "/~~~~~~~~~~~~\" 110 PRINT "\____________/" 120 END というようなものだったと思う. FOR I=0 TO 1000 NEXT で,十分なウエイトになってしまうあたりが,すごいとこだ. そーいえば,このころってまだ, マイコン って言葉が使われていた時代だったなあ. ぼくがプログラミングをはじめたころは,BASIC が全盛の時期だった. 当時は BASIC のプログラムが載っている本が多くあって, なにをかくそうぼく自身,本に載っているプログラムを ゲームやりたさで ひたすら打ち込んで,プログラムをおぼえた,というクチである. プログラムを打ち込み終って,どきどきしながら run させると, 必ずといっていいほど, Syntax Error in 30 (いきなり3行目だったりする) などと言われてしまって,それから本とディスプレイを照らしあわせるという あまりやりたくない作業になるわけである. Syntax Error なら,まだいい.たいていはそこの行にミスがあるからである. やっかいなのは, Illegal function call (関数やステートメントに渡す値がおかしい) とかである.これだと,たいていは,その行ではなく,別の行に間違いがある. いちばんイヤだったのは, Subscript out of range (配列の範囲をこえたアクセス) だ.これだと,まず間違いなく,別の行にミスがあって,変数の値が おかしくなっているのである. しかしそれも, (タダで)ゲームがやりたくてたまらない小学生 にとっては,それほど苦ではなかったようである. この苦労(?)のおかげで,いま思えば,フリーソフトウエアプログラマにとって もっとも重要な力である, どんなエラーが出ても,自力でなんとかする気力 が身についたと思う. どんな本を参考にしていたかというと,一番さいしょに読んで打ち込みはじめたのは, いまでも覚えている,知る人ぞ知る,ナツメ社の, はるみのゲームライブラリII という本だった.この本は残念ながら,どこかへいってしまった. うーん,もう一度,読んでみたいものである. 「あるけあるけゲーム」(tron のようなゲーム)とか, 「スクロールジャンプ」とか, 「ビルディングクラッシュ」とか, 「地底探検ゲーム」とか, ペンゴもどきとか, 月面着陸とかを打ち込んでは遊んでた. この本は当時はやりの, 1画面プログラム を集めた本(しかも,40x25)で,わりと手軽に打ち込めるプログラムが 多かったのだが,それでもパソコンを覚えたての小学生ではキーを探すのも ままならず,1本を入力するのに2時間とか3時間とかかかっていた. しかしそれでも, (タダで)ゲームをやりたいという熱意 は強く,学校が終ったら急いで帰って,きのうの続きを打ち込みはじめる, という日も多かったように思う. 当然,学校でもゲームのことばかり考えているわけであるから,困ったものだ. はるみのゲームライブラリ という本のプログラムも,よく打ち込んだ. そのうち打ち込んだゲームを適当に改良したりするようになる. やがて,自分でもゲームを作り出すようになる. はじめて作ったゲームは,いまでも覚えているが, 「レーザーパックマン」 というタイトルだった. どういうゲームかというと, ・まず,敵がいる.(ランダムで動いている) ・自分がいる.(テンキーの '1', '2', '3', '5' で移動できる) ・自分と敵の X 座標が一致すると,「ピッ」と音がして,レーザーが発射される. (IF X=EX THEN LINE(X,Y)-(EX,EY),"■",2 のようなことをやっているわけである) ・自分と敵の Y 座標が一致したときも,おんなじ. ・レーザーを撃つと,スコアが増える. パッと見てまず思うだろう.そう,このゲームには, ゲームオーバーがない のである. いま思えば,こんなしょーもないゲームでよく遊んでいたものだと思う. 今,思いだせる限りで,レーザーパックマンを再現してみよう. 10 X=20:Y=12:TX=10:TY=10:S=0 20 LOCATE X,Y:PRINT " " 30 LOCATE TX,TY:PRINT " " 40 I$=INKEY$ 50 IF I$="1" AND X>0 THEN X=X-1 60 IF I$="3" AND X<39 THEN X=X+1 70 IF I$="5" AND Y>0 THEN Y=Y-1 80 IF I$="2" AND Y<23 THEN Y=Y+1 90 IF INT(RND(1)*2)+1=1 THEN TX=TX-1:GOTO 130 100 IF INT(RND(1)*2)+1=1 THEN TY=TY-1:GOTO 130 110 IF INT(RND(1)*2)+1=1 THEN TX=TX+1:GOTO 130 120 TY=TY+1 130 LOCATE X,Y:PRINT "○" 140 LOCATE TX,TY:PRINT "●" 150 IF X=TX AND Y=TY THEN LINE(X,Y)-(TX,TY),"■",2:S=S+100:BEEP1:BEEP0:GOTO 170 160 IF X=TX OR Y=TY THEN LINE(X,Y)-(TX,TY),"■",2:S=S+10:BEEP1:BEEP0 170 LOCATE 10,0:PRINT S 180 GOTO 20 たしか,こんなんだったとおもう.(なにしろ,はじめて書いたプログラムですから) 確率的に,敵が左上のほうに行きやすくなってしまったというのをおぼえている. こんなんおもしろいのか? とも思ってしまうが,自分で作ったゲームというのは, それなりにおもしろいものである.(本当かなあ...) ほかにも,インベーダーゲームを作ったことがある. これは,大量のインベーダーをひとつひとつ処理することに無理があったので, GET(X,Y)-(X+9,Y+4),G% してから, PUT(X+VX,Y+VY)-(X+VX+9,Y+VY+4),G% で,インベーダーをまとめて動かしていた. このころの雑誌で忘れられないのが, マイコン BASIC マガジン である. (次回作の OMAKE.jpn に続く) ■■ 参考文献 ぼくは,本が好きだ. 本棚の専門書を分類したり,整頓したりするのが,とても好きである. というわけで,参考文献紹介も兼ねて,ちょっと書評(ていうか,個人的な思い出話) でも書こうかと思う. ■ C言語関係 「はじめての C 改訂第3版 [ANSI C 対応]」 ぼくが大学3年のとき,この本で C 言語に入門したので, けっこう思い入れがある本である. あとで知ったのだが,入門書としては,わりと名著で有名らしい. これを参考にして,大学の授業で, 円周率を(double 型の範囲で)計算するプログラムを作る という課題があったときに,調子にのって, 円周率を10万桁まで計算するプログラム を作った記憶がある.しかも, 計算の途中経過をセーブすることができる という,なかなか気のきいたプログラムだった. 「C プログラミング診断室」 衝動買いした本.いちおうひととおり読んだ...と思う. たしか大学4年のとき,池袋のビックカメラにまだパソコン館が無いころ, ビックカメラの1階の書籍コーナーで買った. 内容はちょっと古めなので,オブジェクト指向が流行りの今としては,ちょっと 古いかもしれない,と思う. 「C プログラミング専門課程」 研究室に入ってから UNIX 上で C 言語でプログラミングをするようになって, 「C 言語をもっと勉強したい!」と思って買った本. これはためになった.この本のおかげで,コンパイラの動作とか,メモリとかが わかってきた. こんな疑問を持ったことを覚えている. 「char * s = "ABC"; などの文字列リテラルは,メモリ上に静的に確保される. ということは, while (1) { printf("ABC\n"); } を実行すると,printf(); が実行されるたびに "ABC" がメモリ上に 配置されるわけだから,そのうちメモリがなくなってしまうのではないだろうか? 」 しかも,これに対する自分の解答が, 「 char * a = "ABC"; char * b = "ABC"; のように,文字列がダブっている場合には,コンパイラが判断して, 同じ領域に割り付けたりするらしい. たぶん,while () で printf() を繰り返したときにも, これと同様に,printf() の実行時には,文字列は同じ領域に 割り付けられるのだろう. 」 うーん,すばらしくとんちんかんというか,さすが BASIC 出身者,というか, こうして書くこともはずかしいような疑問である. (インタプリタとコンパイラの動作を誤解しているわけだ) 「プログラミング言語 C」(いわゆる "K&R" である) 有名な本なので,研究室に入ってからとりあえず買ってみた.ざっと読んだだけ. 「fgetc() の戻り値が,なぜ int 型なのか?」という疑問を持ったときに, この本に解説してあったので, 「なんていい本なんだ!」 と思って買ったんだけど,あんまりちゃんと読んでない. 「C プログラミング FAQ」 これは,いい.最高にためになる. とりあえず1度通して読んだが,またそのうちもう一度通して読みたいと思っている. 中級者くらいになって,たいてい疑問に思うようなことは,必ず書いてあるのが すごい. この本に書いてあることが全般的に理解できてれば,C 言語はほぼ完璧なのでは, と思う. ■ X 関係 「X-Window Ver.11 プログラミング[第2版]」 X のプログラムをはじめたころに,これの第1版が研究室にあったので, よく参考にしてた. そのうち,家で使う分と学校で使う分の2冊が欲しくなってきて,けっきょく, 第2版を自分で買った. X のプログラミングをする人って,この本を参考にしている人がけっこう多い みたいだね.フリーソフトのドキュメントを読んでると,参考文献とかで よく見かけたりする. 「X-Window OSF/Motif プログラミング」 X のプログラムをはじめたころに,これを参考にしてプログラミングしてた. はじめのうちは,Motif (正確には,Lesstif) を使っていたのだが, やはり Motif は商品である,というのと, 「BSD を 256 倍使うための本」(いわゆる,「黒いニゴロの本」である) の,EmiClock 開発秘話で, X のプログラミングは,X ツールキットを使うのがオシャレ というふうに書いてあった,というのがあって,だんだん Motif は使わなくなった. でも X ツールキット専門の本ってなぜかすっごく少なくて,たいていは X ツールキットのプログラミングをするときでも,Motif の本を参考にしたりしてる. ちなみに,EyeClock は, 「BSD を 256 倍使うための本」 に,すっごく影響を受けている. ■ そのほか 「スーパーユーザの日々」 「UNIX ネットワークの日々」 「Mail & News の日々」 研究室のシステム管理者をやるようになって,この本でいろいろ勉強した. 帰宅中の有楽町線のなかでよく読んだ. 内容はちょっと古めだが,基礎的なことがしっかりと書かれているので, 基礎勉強にとてもいい本だと思う.書いてある内容も,とてもしっかりしている. 「UNIX のシステムの勉強がしたいんだけど,なにかいい本はないか?」 「ネットワークの勉強がしたいんだけど,なにかいい本はないか?」 とか聞かれたときには,この本を推薦するようにしている. 「UNIX ネットワークの日々」「Mail & News の日々」は,研究室内の システム管理者育成の勉強会で教材にしていた.この勉強会では,毎回, 「K君」や「中村さん」の役を決めて,読む しかも当然, セリフ付 ということをしていて,朝,研究室に入ってくる卒研生とかが, スーパーユーザーが,学芸会のセリフの練習でもしているかのような姿 をまのあたりにして,ギョッとしていた. 「セキュリティの日々」とかも,出してほしいもんだ. 「GNU ソフトウエアプログラミング」 プログラミングに emacs, gcc, make, gdb を使うときの一連の流れが わかるので,とってもいい本だと思う. 個々のアプリケーションをひとつひとつ詳しく解説してある本はたくさん あるのだが,開発の一連の流れとして解説してある本は,なかなか少ない. 「よしだともこのルート訪問記」 最近買ったのだが,なんていうか,ここまで, システム管理者の実際 が書かれているという本は,他にないのでは? とおもう. (そりゃそうだ,現役の管理者へのインタビューなのだから) ほかの大学や研究室とかではどういうふうに管理されているか,というのが, 非常に幅広く紹介されていて,とてもためになる. というのは,コンピュータやネットワークのシステムの構成など (こういったことも非常にためになるが)が書いてあるだけでなく, 「管理者の人材確保」や「管理者の育成・教育態勢」がどのようになって いるかなどが書かれているからだ. やはり,「人材の確保」と「教育」がいちばん大変で重要なことであって, こういったことが,システム管理の実態だと思う. しかし,読んでいると,他の大学や研究室などの管理態勢や教育態勢が, うらやましくなってしまう ということもある. (次回作の OMAKE.jpn に続く) ■■ うまいもの 寿司がすきである. おごってもらうとしたら, 1.寿司 2.焼肉 3.なんかめずらしいたべもの の順に嬉しい.なにしろ小学生のころは, 寿司屋になりたかった というくらいである. とはいっても,寿司などそうそういっつも食べにいけるものではないから, ふだんは回転寿司にいったり,たまに寿司屋で食べるくらいである. とはいっても,魚の名前をよく知らない.寿司屋でネタを見ても, なんの魚だかわからなかったりする. そのうち,ちゃんとネタの名前をおぼえて, 「なんにいたしますか?」 「そうだなあ.白身のいいとこを握ってくれ」 「へい,おまち」 「お,これはヒラメだね」 なーんて言ってみたいのだが. ちなみに,好きなネタベスト10は, 1. 中トロ 2. ビントロ 3. サーモン,ハマチ,マグロ赤身 6. 鯛,メカジキ,サンマ 9. カニ味噌,ウニ てなかんじだろうか.適当に考えただけなのだが. うーん,こうしてみると,まだまだ子供の味覚である. 池袋は,やたらと回転寿司が多いので,嬉しい. (次回作の OMAKE.jpn に続く) ■■ 携帯端末 わずか 800g 程度の Libretto SS1000 に FreeBSD と X を入れて, 電車の中だろうが,待ち合わせの「いけふくろう」の前だろうが, ところかまわずプログラミングをしている. ・携帯端末(いわゆる,WindowsCEマシン) ・携帯Java端末 ・携帯電話 ちょっと前までは,携帯端末が今後の主流になると思っていた. しかし今では,これからは,携帯端末でなく,携帯電話が主流になって, 携帯電話でなんでもできる,というような方向に進んで行くのだろうとおもう. というのは,携帯電話はやはり「電話」という,実用的で馴染みやすい機能が メインであるからだ. 「GPS標準搭載の携帯端末」があったとしても,GPSをやるためにわざわざ 携帯端末を買って,操作をおぼえようとする人は少ないだろう. しかし,「GPSつき携帯電話」ならば,携帯電話が欲しい人で,物珍しさで 買ってしまいそうな人が出てくるような気はする. きっとそのうち,携帯電話に Java や Linux が搭載され,美術館に行ったら 自分の携帯電話に案内が自動的にインストールされて,自分の携帯電話が 案内してくれる,というようになるのだろう. 携帯電話のメモリサイズや処理能力はどんどん進化しているから,いまパソコンで できるようなことは,ぜんぶ携帯電話でできるようになってしまう. そのうち映画とかも見れるようになって,電車の中の10分くらいの中途半端な 自由時間に,ちょっと映画をみたり,ロールプレイングゲームの続きをしたり, 電子ペットにえさをあげたりするようになるのだろう. 携帯電話のいいところは,小さくて電車の中とかでいじっていても違和感は無いが, 多彩の機能を盛り込める程度には大きい,というところだ. たとえば,GPSつきのごつくてでかい腕時計が出ても,それをいつもつけようとする 人はいないだろう. また,「違和感が無い」というのはとても重要だ. ぼくのようにところかまわず人目も気にせず,いつどんなところでもプログラムを 書き出してしまうような人間はともかく,普通の人は,やはり人目は気になる (のだと思う)からだ. このファイルはここまで. xfireworks-1.3.orig/AUTHORS0100644000175000017500000000043507142030232014643 0ustar kmutokmutoProgramed by SAKAI Hiroaki. E-Mail: sakai@seki.ee.kagu.sut.ac.jp, hsakai@pfu.co.jp Web site: http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/index.html Mirror site: http://hp.vector.co.jp/authors/VA014157/myfreesoft/index.html http://www.people.or.jp/~hsakai/myfreesoft/index.html xfireworks-1.3.orig/Piece.c0100644000175000017500000005370707142030232014776 0ustar kmutokmuto#include "PieceP.h" #include "configure.h" #include "etc.h" #ifndef DEFAULT_PROBABILITY #define DEFAULT_PROBABILITY 0.1 #endif #ifndef DEFAULT_SIZE #define DEFAULT_SIZE 3 #endif #ifndef DEFAULT_AIR #define DEFAULT_AIR 0.05 #endif #ifndef DEFAULT_GRAVITY #define DEFAULT_GRAVITY 0.3 #endif #ifndef DEFAULT_TRANSMISSION #define DEFAULT_TRANSMISSION 60.0 #endif #ifndef DEFAULT_AFTER_IMAGE #define DEFAULT_AFTER_IMAGE 10 #endif /* x, y, z などの配列を一括確保して,malloc() の数を減らし,負荷を下げる */ #if 1 #ifndef ONE_BUNDLE_ALLOCATE #define ONE_BUNDLE_ALLOCATE #endif #else #ifdef ONE_BUNDLE_ALLOCATE #undef ONE_BUNDLE_ALLOCATE #endif #endif /*===========================================================================*/ /* オブジェクトのメンバの取得 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* PieceClass クラス */ /*---------------------------------------------------------------------------*/ char * PieceClass_GetName(PieceClass piece_class) { return (piece_class->name); } double PieceClass_GetProbability(PieceClass piece_class) { return (piece_class->probability); } ObjList PieceClass_GetGCListList(PieceClass piece_class) { return (piece_class->gc_list_list); } ObjList PieceClass_GetNextList(PieceClass piece_class) { return (piece_class->next_list); } /*---------------------------------------------------------------------------*/ /* PieceNext クラス */ /*---------------------------------------------------------------------------*/ PieceClass PieceNext_GetPieceClass(PieceNext piece_next) { return (piece_next->piece_class); } double PieceNext_GetPower(PieceNext piece_next) { return (piece_next->power); } int PieceNext_GetNumber(PieceNext piece_next) { return (piece_next->number); } /*---------------------------------------------------------------------------*/ /* Pieces クラス */ /*---------------------------------------------------------------------------*/ PieceClass Pieces_GetPieceClass(Pieces pieces) {return (pieces->piece_class);} int Pieces_GetArraySize(Pieces pieces) { return (pieces->array_size); } int Pieces_GetNumber(Pieces pieces) { return (pieces->number); } double * Pieces_GetX(Pieces pieces) { return (pieces->x); } double * Pieces_GetY(Pieces pieces) { return (pieces->y); } double * Pieces_GetZ(Pieces pieces) { return (pieces->z); } double * Pieces_GetVx(Pieces pieces) { return (pieces->vx); } double * Pieces_GetVy(Pieces pieces) { return (pieces->vy); } double * Pieces_GetVz(Pieces pieces) { return (pieces->vz); } int Pieces_GetSize(Pieces pieces) { return (pieces->piece_class->size); } ObjList Pieces_GetGCList(Pieces pieces) { return ((ObjList)ObjListData_GetObj(pieces->gc_list)); } /*===========================================================================*/ /* PieceClass オブジェクトの作成・削除用 */ /*===========================================================================*/ PieceClass PieceClass_Create(char * name, int size, double probability, double air, double gravity, double transmission, int after_image_length, int fine, ObjList gc_list_list, ObjList next_list, Disp disp) { PieceClass piece_class; int i; piece_class = (PieceClass)malloc(sizeof(_PieceClass)); if (!piece_class) Error("PieceClass_Create", "Cannot allocate memory."); if ((name == NULL) || (name[0] == '\0')) name = "Unknown\0"; piece_class->name = (char *)malloc(sizeof(char) * (StringLen(name) + 1)); if (piece_class->name == NULL) Error("PieceClass_Create", "Cannot allocate memory."); StringCpy(piece_class->name, name); piece_class->size = size; piece_class->probability = probability; piece_class->air = air; piece_class->gravity = gravity; piece_class->transmission = transmission; piece_class->after_image_length = after_image_length; if (fine < 1) fine = 1; piece_class->fine = fine; piece_class->step = 100.0 / piece_class->fine; if (gc_list_list) piece_class->gc_list_list = gc_list_list; else piece_class->gc_list_list = ObjList_Create(); if (next_list) piece_class->next_list = next_list; else piece_class->next_list = ObjList_Create(); return (piece_class); } PieceClass PieceClass_Destroy(PieceClass piece_class) { if (!piece_class) return (NULL); if (piece_class->name) free(piece_class->name); if (piece_class->gc_list_list) ObjList_Destroy(piece_class->gc_list_list); if (piece_class->next_list) ObjList_Destroy(piece_class->next_list); free(piece_class); return (NULL); } /*===========================================================================*/ /* PieceNext オブジェクトの作成・削除用 */ /*===========================================================================*/ PieceNext PieceNext_Create(PieceClass piece_class, double power, int n) { PieceNext next; next = (PieceNext)malloc(sizeof(_PieceNext)); if (!next) Error("PieceNext_Create", "Cannot allocate memory."); next->piece_class = piece_class; next->power = power; next->number = n; return (next); } PieceNext PieceNext_Destroy(PieceNext next) { if (!next) return (NULL); free(next); return (NULL); } /*===========================================================================*/ /* 内部で使用する関数 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* PieceClass の検索 */ /* 見つからなかった場合には,PieceClass オブジェクトを生成し, */ /* リストに追加する. */ /*---------------------------------------------------------------------------*/ static PieceClass PieceClassList_SearchPieceClass(ObjList list, char * name, Disp disp, int default_size, double default_air, double default_gravity, double default_transmission, int default_after_image, int fine) { ObjListData current; PieceClass piece_class; if (!list) Error("PieceClassList_SearchPieceClass", "PieceClassList has not created."); for (current = ObjList_GetStart(list); !ObjList_IsEndEdge(list, current); current = ObjListData_GetNext(current)) { piece_class = (PieceClass)ObjListData_GetObj(current); if (!StringCmp(piece_class->name, name)) { return (piece_class); } } /* 見つからなかった場合には,作成し,リストに追加する */ piece_class = PieceClass_Create(name, default_size, -1.0, default_air, default_gravity, default_transmission, default_after_image, fine, NULL, NULL, disp); ObjList_InsertObjToEnd(list, piece_class, (ObjDestructor)PieceClass_Destroy); return (piece_class); } /*---------------------------------------------------------------------------*/ /* 単語の取得 */ /*---------------------------------------------------------------------------*/ static char * GetWord(Stream stream) { char * word; word = Stream_GetWord(stream, NULL, 0, "", /* この文字で切り分ける */ " \t", /* この文字でも切り分ける */ "!#$%", /* コメント行の先頭文字 '#' など */ "\n", /* 行末文字 '\n' など */ "\"\'", /* 引用符文字 '\"' など */ "", /* 文字列先頭の読みとばし文字 */ "" /* 文字列末尾の読みとばし文字 */ ); return (word); } static char * GetWord2(Stream stream) { char * word; word = Stream_GetWord(stream, NULL, 0, "", /* この文字で切り分ける */ " \t", /* この文字でも切り分ける */ "", /* コメント行の先頭文字 '#' など */ "\n", /* 行末文字 '\n' など */ "\"\'", /* 引用符文字 '\"' など */ "", /* 文字列先頭の読みとばし文字 */ "" /* 文字列末尾の読みとばし文字 */ ); return (word); } static ObjList ReadNext(ObjList piece_class_list, char * word, Disp disp, int default_size, double default_air, double default_gravity, double default_transmission, int default_after_image, int fine, int next_power_mag, int next_number_mag) { ObjList list; Stream stream; char * w1; char * w2; char * w3; PieceClass piece_class; double power; int n; list = ObjList_Create(); if (!word) return (list); stream = Stream_CreateFromCharacters(word); if (!stream) return (list); while ((w1 = GetWord2(stream)) != NULL) { w2 = w3 = NULL; piece_class = PieceClassList_SearchPieceClass(piece_class_list, w1, disp, default_size, default_air, default_gravity, default_transmission, default_after_image, fine); w2 = GetWord2(stream); if ((w3 = GetWord2(stream)) != NULL) { power = atof(w2) * next_power_mag * 0.01; n = atoi(w3); if (n > 0) { n = (n * next_number_mag + 50) / 100; if (n < 1) n = 1; } ObjList_InsertObjToEnd(list, PieceNext_Create(piece_class, power, n), (ObjDestructor)PieceNext_Destroy); } if (w1) free(w1); if (w2) free(w2); if (w3) free(w3); } Stream_Destroy(stream); return (list); } /*===========================================================================*/ /* データの読み込み */ /*===========================================================================*/ ObjList PieceClassList_CreateFromStream(Disp disp, ColorGCDatabase database, Stream stream, int fine, int probability_mag, int size_mag, int air_mag, int gravity_mag, int transmission_mag, int after_image_mag, int color_length_mag, int next_power_mag, int next_number_mag) { ObjList piece_class_list; PieceClass current = NULL; char * word; char * word2; ObjList color_gc_list; double default_probability = DEFAULT_PROBABILITY * probability_mag * 0.01; int default_size = (DEFAULT_SIZE * size_mag + 50) / 100; double default_air = DEFAULT_AIR * air_mag * 0.01; double default_gravity = DEFAULT_GRAVITY * gravity_mag * 0.01; double default_transmission = DEFAULT_TRANSMISSION * transmission_mag * 0.01; int default_after_image = (DEFAULT_AFTER_IMAGE * after_image_mag + 50) / 100; piece_class_list = ObjList_Create(); while ((word = GetWord(stream)) != NULL) { word2 = NULL; if (!StringCmp(word, "Name")) { if ((word2 = GetWord(stream)) != NULL) { current = PieceClassList_SearchPieceClass(piece_class_list, word2, disp, default_size, default_air, default_gravity, default_transmission, default_after_image, fine); } } else if (!StringCmp(word, "DefaultProbability")) { if ((word2 = GetWord(stream)) != NULL) { default_probability = atof(word2) * probability_mag * 0.01; } } else if (!StringCmp(word, "DefaultSize")) { if ((word2 = GetWord(stream)) != NULL) { default_size = (atoi(word2) * size_mag + 50) / 100; } } else if (!StringCmp(word, "DefaultAir")) { if ((word2 = GetWord(stream)) != NULL) { default_air = atof(word2) * air_mag * 0.01; } } else if (!StringCmp(word, "DefaultGravity")) { if ((word2 = GetWord(stream)) != NULL) { default_gravity = atof(word2) * gravity_mag * 0.01; } } else if (!StringCmp(word, "DefaultTransmission")) { if ((word2 = GetWord(stream)) != NULL) { default_transmission = atof(word2) * transmission_mag * 0.01; } } else if (!StringCmp(word, "DefaultAfterImage")) { if ((word2 = GetWord(stream)) != NULL) { default_after_image = (atoi(word2) * after_image_mag + 50) / 100; } } else { if (current) { if (!StringCmp(word, "Size")) { if ((word2 = GetWord(stream)) != NULL) { if (!StringCmp(word2, "Default") || !StringCmp(word2, "default")) current->size = default_size; else current->size = (atoi(word2) * size_mag + 50) / 100; } } else if (!StringCmp(word, "Probability")) { if ((word2 = GetWord(stream)) != NULL) { if (!StringCmp(word2, "Default") || !StringCmp(word2, "default")) current->probability = default_probability; else if (!StringCmp(word2, "None") || !StringCmp(word2, "none")) current->probability = -1.0; else current->probability = atof(word2) * probability_mag * 0.01; } } else if (!StringCmp(word, "Air")) { if ((word2 = GetWord(stream)) != NULL) { if (!StringCmp(word2, "Default") || !StringCmp(word2, "default")) current->air = default_air; else current->air = atof(word2) * air_mag * 0.01; } } else if (!StringCmp(word, "Gravity")) { if ((word2 = GetWord(stream)) != NULL) { if (!StringCmp(word2, "Default") || !StringCmp(word2, "default")) current->gravity = default_gravity; else current->gravity = atof(word2) * gravity_mag * 0.01; } } else if (!StringCmp(word, "Transmission")) { if ((word2 = GetWord(stream)) != NULL) { if (!StringCmp(word2, "Default") || !StringCmp(word2, "default")) current->transmission = default_transmission; else current->transmission = atof(word2) * transmission_mag * 0.01; } } else if (!StringCmp(word, "AfterImage")) { if ((word2 = GetWord(stream)) != NULL) { if (!StringCmp(word2, "Default") || !StringCmp(word2, "default")) current->after_image_length = default_after_image; else current->after_image_length = (atoi(word2) * after_image_mag + 50) / 100; } } else if (!StringCmp(word, "Color")) { if ((word2 = GetWord(stream)) != NULL) { if (current->gc_list_list == NULL) current->gc_list_list = ObjList_Create(); if (!StringEqual(word2, "None") && !StringEqual(word2, "none")) { color_gc_list = CreateColorGCListFromCharacters(database, word2, current->after_image_length, fine, color_length_mag); ObjList_Concatenate(current->gc_list_list, color_gc_list); } } } else if (!StringCmp(word, "Next")) { if ((word2 = GetWord(stream)) != NULL) { if (current->next_list == NULL) current->next_list = ObjList_Create(); if (!StringEqual(word2, "None") && !StringEqual(word2, "none")) { ObjList_Concatenate(current->next_list, ReadNext(piece_class_list, word2, disp, default_size, default_air, default_gravity, default_transmission, default_after_image, fine, next_power_mag, next_number_mag)); } } } else if (!StringCmp(word, "End")) { if (word) free(word); if (word2) free(word2); return (piece_class_list); } else { fprintf(stderr, "Unknown command : %s\n", word); } } else { fprintf(stderr, "Cannot specify class name. Command was ignored. : %s\n", word); } } if (word) free(word); if (word2) free(word2); } return (piece_class_list); } /*===========================================================================*/ /* Pieces オブジェクトの操作 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* Pieces オブジェクトの初期化 */ /*---------------------------------------------------------------------------*/ int Pieces_Initialize(Pieces pieces, PieceClass piece_class, double power, int number, int n, double * x, double * y, double * z, double * vx, double * vy, double * vz, int x_min, int y_min, int x_max, int y_max, Calculator calculator) { int i, j, a; int rad, z_rad; double p, t; pieces->piece_class = piece_class; pieces->gc_list = ObjList_GetStartEdge(pieces->piece_class->gc_list_list); if (n * number > pieces->array_size) return (1); a = 0; for (i = 0; i < n; i++) { for (j = 0; j < number; j++) { z_rad = Rand(CALCULATOR_DEFAULT_DEGREE); p = Calculator_GetCos(calculator, z_rad); rad = Rand(CALCULATOR_DEFAULT_DEGREE); pieces->x[a] = x[i]; pieces->y[a] = y[i]; pieces->z[a] = z[i]; t = pieces->piece_class->transmission * 0.01; pieces->vx[a] = Calculator_GetCos(calculator, rad) *power*p+ vx[i] * t; pieces->vy[a] = Calculator_GetSin(calculator, rad) *power*p+ vy[i] * t; pieces->vz[a] = Calculator_GetSin(calculator, z_rad) * power + vz[i] * t; if ( ((pieces->x[a] < x_min) && (pieces->vx[a] < 0.0)) || ((pieces->x[a] > x_max) && (pieces->vx[a] > 0.0)) || ((pieces->y[a] > y_max) && (pieces->vy[a] > 0.0)) ) { /* None */ } else { a++; } } } pieces->number = a; return (0); } /*---------------------------------------------------------------------------*/ /* Pieces オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ Pieces Pieces_Create(PieceClass piece_class, double power, int number, int n, double * x, double * y, double * z, double * vx, double * vy, double * vz, int x_min, int y_min, int x_max, int y_max, Calculator calculator) { Pieces pieces; pieces = (Pieces)malloc(sizeof(_Pieces)); if (!pieces) Error("Pieces_Create", "Cannot allocate memory"); pieces->array_size = number * n; /* Pieces オブジェクトは使い回しするので,小さいサイズのものは */ /* メモリを無駄に食ってしまうので,メモリの節約のため,あまり小さな */ /* サイズのものは作らないようにする. */ if (pieces->array_size < 30) pieces->array_size = 30; if (pieces->array_size) { #ifdef ONE_BUNDLE_ALLOCATE pieces->x = (double *)malloc(sizeof(double) * pieces->array_size * 6); if (pieces->x == NULL) Error("Pieces_Create", "Cannot allocate memory"); pieces->y = pieces->x + pieces->array_size * 1; pieces->z = pieces->x + pieces->array_size * 2; pieces->vx = pieces->x + pieces->array_size * 3; pieces->vy = pieces->x + pieces->array_size * 4; pieces->vz = pieces->x + pieces->array_size * 5; #else pieces->x = (double *)malloc(sizeof(double) * pieces->array_size); if (pieces->x == NULL) Error("Pieces_Create", "Cannot allocate memory"); pieces->y = (double *)malloc(sizeof(double) * pieces->array_size); if (pieces->y == NULL) Error("Pieces_Create", "Cannot allocate memory"); pieces->z = (double *)malloc(sizeof(double) * pieces->array_size); if (pieces->z == NULL) Error("Pieces_Create", "Cannot allocate memory"); pieces->vx = (double *)malloc(sizeof(double) * pieces->array_size); if (pieces->vx == NULL) Error("Pieces_Create", "Cannot allocate memory"); pieces->vy = (double *)malloc(sizeof(double) * pieces->array_size); if (pieces->vy == NULL) Error("Pieces_Create", "Cannot allocate memory"); pieces->vz = (double *)malloc(sizeof(double) * pieces->array_size); if (pieces->vz == NULL) Error("Pieces_Create", "Cannot allocate memory"); #endif } else { pieces->x = NULL; pieces->y = NULL; pieces->z = NULL; pieces->vx = NULL; pieces->vy = NULL; pieces->vz = NULL; } Pieces_Initialize(pieces, piece_class, power, number, n, x, y, z, vx, vy, vz, x_min, y_min, x_max, y_max, calculator); return (pieces); } /*---------------------------------------------------------------------------*/ /* Piece オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ Pieces Pieces_Destroy(Pieces pieces) { if (!pieces) return (NULL); #ifdef ONE_BUNDLE_ALLOCATE if (pieces->x ) free(pieces->x ); #else if (pieces->x ) free(pieces->x ); if (pieces->y ) free(pieces->y ); if (pieces->z ) free(pieces->z ); if (pieces->vx) free(pieces->vx); if (pieces->vy) free(pieces->vy); if (pieces->vz) free(pieces->vz); #endif free(pieces); return (NULL); } /*---------------------------------------------------------------------------*/ /* Pieces オブジェクトの移動 */ /*---------------------------------------------------------------------------*/ int Pieces_Move(Pieces pieces, int x_min, int y_min, int x_max, int y_max, int size) { int length; int i, a; double z; double step; double air, g; double tmp1, tmp2; if (ObjList_IsEnd(pieces->piece_class->gc_list_list, pieces->gc_list)) return (1); step = pieces->piece_class->step; air = 1.0 - pieces->piece_class->air * step; g = pieces->piece_class->gravity * step; tmp1 = step * size * 0.001; a = 0; for (i = 0; i < pieces->number; i++) { if (a) { pieces->x[ i] = pieces->x[ i + a]; pieces->y[ i] = pieces->y[ i + a]; pieces->z[ i] = pieces->z[ i + a]; pieces->vx[i] = pieces->vx[i + a]; pieces->vy[i] = pieces->vy[i + a]; pieces->vz[i] = pieces->vz[i + a]; } pieces->vy[i] += g; /* 空気抵抗の計算 */ pieces->vx[i] *= air; pieces->vy[i] *= air; pieces->vz[i] *= air; /* 奥行きの計算 */ pieces->z[i] += pieces->vz[i] * step; z = 1.0 - pieces->z[i] * (1.0 / 1000.0); if (z < 0.01) z = 0.01; tmp2 = z * tmp1; pieces->x[i] += pieces->vx[i] * tmp2; pieces->y[i] += pieces->vy[i] * tmp2; if (((pieces->x[i] < x_min) && (pieces->vx[i] < 0.0)) || ((pieces->x[i] > x_max) && (pieces->vx[i] > 0.0)) || (pieces->y[i] > y_max)) { i--; a++; pieces->number--; } } if (pieces->number == 0) return (1); pieces->gc_list = ObjListData_GetNext(pieces->gc_list); return (0); } /*****************************************************************************/ /* End of Program */ /*****************************************************************************/ xfireworks-1.3.orig/Piece.h0100644000175000017500000001306207142030233014772 0ustar kmutokmuto#ifndef _XFIREWORKS_Piece_h_INCLUDED_ #define _XFIREWORKS_Piece_h_INCLUDED_ typedef struct _PieceClass * PieceClass; typedef struct _PieceNext * PieceNext; typedef struct _Pieces * Pieces; #include "Obj.h" #include "Stream.h" #include "ColorGC.h" #include "Calculator.h" /*===========================================================================*/ /* オブジェクトのメンバの取得 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* PieceClass クラス */ /*---------------------------------------------------------------------------*/ char * PieceClass_GetName(PieceClass piece_class); double PieceClass_GetProbability(PieceClass piece_class); ObjList PieceClass_GetGCListList(PieceClass piece_class); ObjList PieceClass_GetNextList(PieceClass piece_class); /*---------------------------------------------------------------------------*/ /* PieceNext クラス */ /*---------------------------------------------------------------------------*/ PieceClass PieceNext_GetPieceClass(PieceNext piece_next); double PieceNext_GetPower(PieceNext piece_next); int PieceNext_GetNumber(PieceNext piece_next); /*---------------------------------------------------------------------------*/ /* Pieces クラス */ /*---------------------------------------------------------------------------*/ PieceClass Pieces_GetPieceClass(Pieces pieces); int Pieces_GetArraySize(Pieces pieces); int Pieces_GetNumber(Pieces pieces); double * Pieces_GetX(Pieces pieces); double * Pieces_GetY(Pieces pieces); double * Pieces_GetZ(Pieces pieces); double * Pieces_GetVx(Pieces pieces); double * Pieces_GetVy(Pieces pieces); double * Pieces_GetVz(Pieces pieces); int Pieces_GetSize(Pieces pieces); ObjList Pieces_GetGCList(Pieces pieces); /*===========================================================================*/ /* PieceClass オブジェクトの作成・削除用 */ /*===========================================================================*/ PieceClass PieceClass_Create(char * name, int size, double probability, double air, double gravity, double transmission, int after_image_length, int fine, ObjList gc_list_list, ObjList next_list, Disp disp); PieceClass PieceClass_Destroy(PieceClass piece_class); /*===========================================================================*/ /* PieceNext オブジェクトの作成・削除用 */ /*===========================================================================*/ PieceNext PieceNext_Create(PieceClass piece_class, double power, int n); PieceNext PieceNext_Destroy(PieceNext next); /*===========================================================================*/ /* データの読み込み */ /*===========================================================================*/ ObjList PieceClassList_CreateFromStream(Disp disp, ColorGCDatabase database, Stream stream, int fine, int probability_mag, int size_mag, int air_mag, int gravity_mag, int transmission_mag, int after_image_mag, int color_length_mag, int next_power_mag, int next_number_mag); /*===========================================================================*/ /* Pieces オブジェクトの操作 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* Pieces オブジェクトの初期化 */ /*---------------------------------------------------------------------------*/ int Pieces_Initialize(Pieces pieces, PieceClass piece_class, double power, int number, int n, double * x, double * y, double * z, double * vx, double * vy, double * vz, int x_min, int y_min, int x_max, int y_max, Calculator calculator); /*---------------------------------------------------------------------------*/ /* Pieces オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ Pieces Pieces_Create(PieceClass piece_class, double power, int number, int n, double * x, double * y, double * z, double * vx, double * vy, double * vz, int x_min, int y_min, int x_max, int y_max, Calculator calculator); /*---------------------------------------------------------------------------*/ /* Piece オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ Pieces Pieces_Destroy(Pieces pieces); /*---------------------------------------------------------------------------*/ /* Pieces オブジェクトの移動 */ /*---------------------------------------------------------------------------*/ int Pieces_Move(Pieces pieces, int x_min, int y_min, int x_max, int y_max, int size); #endif /*****************************************************************************/ /* End of Program */ /*****************************************************************************/ xfireworks-1.3.orig/COPYING0100644000175000017500000004311007142030233014624 0ustar kmutokmuto GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xfireworks-1.3.orig/Stream.c0100644000175000017500000003204607142030232015175 0ustar kmutokmuto/*****************************************************************************/ /* Stream Class Library Copyright (c) 1999-2000 Sakai Hiroaki. */ /* All Rights Reserved. */ /*===========================================================================*/ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2, or (at your option) */ /* any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; see the file COPYING. If not, write to */ /* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /*****************************************************************************/ /*****************************************************************************/ /* ここから */ /*****************************************************************************/ #include "StreamP.h" /*****************************************************************************/ /* 関数の定義 */ /*****************************************************************************/ /*===========================================================================*/ /* エラー処理 */ /*===========================================================================*/ static void Stream_ErrorExit(char * function, char * message) { fprintf(stderr, "Error in %s():%s\n", function, message); exit(1); } /*===========================================================================*/ /* オブジェクトの生成 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ Stream Stream_Create(CreateStreamFrom from, void * object) { Stream this; this = (Stream)malloc(sizeof(_Stream)); if (this == NULL) Stream_ErrorExit("Stream_Create", "Canot allocate memory."); this->unget_buffer = NULL; this->end_flag = 0; this->from = from; switch (this->from) { case CREATE_NO_STREAM : this->type = STREAM_TYPE_NONE; this->object.dummy = NULL; break; case CREATE_STREAM_FROM_FILE : this->type = STREAM_TYPE_FILE_POINTER; this->object.file_pointer = fopen((char *)object, "rt"); if (this->object.file_pointer == NULL) { free(this); return (NULL); } break; case CREATE_STREAM_FROM_FILE_POINTER : this->type = STREAM_TYPE_FILE_POINTER; this->object.file_pointer = (FILE *)object; break; case CREATE_STREAM_FROM_CHARACTERS : this->type = STREAM_TYPE_CHARACTERS; this->object.characters = (char *)object; break; default : Stream_ErrorExit("Stream_Create", "Invalid type."); } return (this); } /*---------------------------------------------------------------------------*/ /* なにもないところから生成(ダミー用) */ /*---------------------------------------------------------------------------*/ Stream Stream_CreateFromNone() { return (Stream_Create(CREATE_NO_STREAM, (void *)NULL)); } /*---------------------------------------------------------------------------*/ /* ファイルから生成 */ /*---------------------------------------------------------------------------*/ Stream Stream_CreateFromFile(char * filename) { return (Stream_Create(CREATE_STREAM_FROM_FILE, (void *)filename)); } /*---------------------------------------------------------------------------*/ /* ファイルポインタから生成 */ /*---------------------------------------------------------------------------*/ Stream Stream_CreateFromFilePointer(FILE * fp) { return (Stream_Create(CREATE_STREAM_FROM_FILE_POINTER, (void *)fp)); } /*---------------------------------------------------------------------------*/ /* 文字列(char * 型)から生成 */ /*---------------------------------------------------------------------------*/ Stream Stream_CreateFromCharacters(char * characters) { return (Stream_Create(CREATE_STREAM_FROM_CHARACTERS, (void *)characters)); } /*===========================================================================*/ /* オブジェクトの消去 */ /*===========================================================================*/ int Stream_Destroy(Stream this) { UngetBuffer * p; if (!this) Stream_ErrorExit("Stream_Destroy", "Object is not created."); switch (this->from) { case CREATE_NO_STREAM : break; case CREATE_STREAM_FROM_FILE : fclose(this->object.file_pointer); break; case CREATE_STREAM_FROM_FILE_POINTER : break; case CREATE_STREAM_FROM_CHARACTERS : break; default : break; } while (this->unget_buffer) { p = this->unget_buffer->next; free(this->unget_buffer); this->unget_buffer = p; } free(this); return (0); } /*===========================================================================*/ /* 文字列の取得 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* 読み込む文字がまだあるかどうか */ /*---------------------------------------------------------------------------*/ int Stream_IsEnd(Stream this) { return (this->end_flag); } /*---------------------------------------------------------------------------*/ /* Stream から1文字を取得(get)する. */ /*---------------------------------------------------------------------------*/ int Stream_GetCharacter(Stream this) { UngetBuffer * p; int c; if (!this) Stream_ErrorExit("Stream_GetCharacter", "Object is not created."); if (this->end_flag) { c = EOF; } else if (this->unget_buffer) { c = this->unget_buffer->character; p = this->unget_buffer->next; free(this->unget_buffer); this->unget_buffer = p; } else { switch (this->type) { case STREAM_TYPE_NONE : c = EOF; this->end_flag = 1; break; case STREAM_TYPE_FILE_POINTER : c = fgetc(this->object.file_pointer); if (c == EOF) this->end_flag = 1; break; case STREAM_TYPE_CHARACTERS : c = (int)(*(this->object.characters)); if (c == '\0') { c = EOF; this->end_flag = 1; } else { (this->object.characters)++; } break; default : Stream_ErrorExit("Stream_GetCharacter", "Invalid type."); } } return (c); } /*---------------------------------------------------------------------------*/ /* Stream に1文字を返却(unget)する. */ /*---------------------------------------------------------------------------*/ int Stream_UngetCharacter(Stream this, int c) { UngetBuffer * p; char character = (char)c; if (!this) Stream_ErrorExit("Stream_UngetCharacter", "Object is not created."); if (c == EOF) { this->end_flag = 1; return (EOF); } p = (UngetBuffer *)malloc(sizeof(UngetBuffer)); if (!p) Stream_ErrorExit("Stream_UngetCharacter", "Cannot allocate memory."); this->end_flag = 0; p->character = character; p->next = this->unget_buffer; this->unget_buffer = p; return (character); } /*---------------------------------------------------------------------------*/ /* Stream に文字列を返却(unget)する. */ /*---------------------------------------------------------------------------*/ int Stream_UngetCharacters(Stream this, char * characters) { int n = 0; int i; if (!this) Stream_ErrorExit("Stream_UngetCharacters", "Object is not created."); for (i = 0; characters[i] != '\0'; i++) { /* None */ } for(i--; i >= 0; i--) { Stream_UngetCharacter(this, characters[i]); n++; } return (n); } /*---------------------------------------------------------------------------*/ /* 文字列中に文字があるかどうかを判定 */ /*---------------------------------------------------------------------------*/ static int CheckWord(char * s, int c) { if (c == EOF) return (0); if (s == NULL) return (0); while (*s != '\0') { if (c == *s) return (1); s++; } return (0); } /*---------------------------------------------------------------------------*/ /* 文字列に文字を追加 */ /*---------------------------------------------------------------------------*/ static char * AddCharacter(char * buffer, int * buf_len, int * i, char c, int extend) { if (*i >= *buf_len - 1) { if (!extend) return (buffer); (*buf_len) *= 2; if (!buffer) buffer = (char *)malloc(sizeof(char) * (*buf_len)); else buffer = (char *)realloc((void *)buffer, sizeof(char) * (*buf_len)); if (!buffer) Stream_ErrorExit("AddCharacter", "Cannot allocate memory."); } buffer[*i] = c; (*i)++; return (buffer); } /*---------------------------------------------------------------------------*/ /* Stream からトークンで区切って文字列を読み込み,文字列(String 型)で返す. */ /* 引用符やコメント行の解釈を行う. */ /*---------------------------------------------------------------------------*/ /* split1 は,複数の区切り文字が連続する場合にも,ヌル文字として切り分ける. */ /* split2 は,複数の区切り文字が連続する場合には,ひとつの区切り文字として */ /* 処理する. */ /*---------------------------------------------------------------------------*/ char * Stream_GetWord(Stream this, /* 読み込み元の Stream */ char * buffer, int buffer_length, char * split1, /* この文字で切り分ける */ char * split2, /* この文字でも切り分ける */ char * comment, /* コメント行の先頭文字 '#' など */ char * lineend, /* 行末文字 '\n' など */ char * quotation, /* 引用符文字 '\"' など */ char * head_skip, /* 文字列先頭の読みとばし文字 */ char * tail_skip /* 文字列末尾の読みとばし文字 */ ) { int c; int i = 0; int extend = 0; /* バッファを拡張できるか */ if (!this) Stream_ErrorExit("Stream_GetWord", "Object is not created."); do { c = Stream_GetCharacter(this); if (CheckWord(comment, c)) { do { c = Stream_GetCharacter(this); } while (!CheckWord(lineend, c) && (c != EOF)); } } while (CheckWord(split2, c) || CheckWord(comment, c) || CheckWord(lineend, c)); if (c == EOF) return (NULL); /* 読み出す単語が存在しない */ if (!buffer) { extend = 1; buffer_length = 10; buffer = (char *)malloc(sizeof(char) * buffer_length); if (!buffer) Stream_ErrorExit("Stream_GetWord", "Cannot allocate memory."); } if (CheckWord(quotation, c)) { while (1) { c = Stream_GetCharacter(this); if (CheckWord(quotation, c) || (c == EOF)) break; buffer = AddCharacter(buffer, &buffer_length, &i, c, extend); } } else { while (CheckWord(head_skip, c) && (c != EOF)) c = Stream_GetCharacter(this); while (1) { if (c == EOF) { break; } if (CheckWord(comment, c) || CheckWord(quotation, c) || CheckWord(split1, c) || CheckWord(split2, c) || CheckWord(lineend, c)) { Stream_UngetCharacter(this, c); break; } buffer = AddCharacter(buffer, &buffer_length, &i, c, extend); c = Stream_GetCharacter(this); } while ((i > 0) && (CheckWord(tail_skip, buffer[i - 1]))) i--; } if (i <= buffer_length - 1) buffer[i] = '\0'; return (buffer); } /*****************************************************************************/ /* ここまで */ /*****************************************************************************/ /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/Stream.h0100644000175000017500000002016207142030233015177 0ustar kmutokmuto/*****************************************************************************/ /* Stream Class Library Copyright (c) 1999-2000 Sakai Hiroaki. */ /* All Rights Reserved. */ /*===========================================================================*/ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2, or (at your option) */ /* any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; see the file COPYING. If not, write to */ /* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /*****************************************************************************/ #ifndef _STREAM_H_INCLUDED_ #define _STREAM_H_INCLUDED_ /*****************************************************************************/ /* ここから */ /*****************************************************************************/ /*****************************************************************************/ /* Stream 型の定義 */ /*****************************************************************************/ typedef struct _Stream * Stream; /*****************************************************************************/ /* ヘッダファイルのインクルード */ /*****************************************************************************/ #include #include /*****************************************************************************/ /* 型の定義(外部に公開するもの) */ /*****************************************************************************/ /*===========================================================================*/ /* Stream 型の作成元のタイプ */ /*===========================================================================*/ typedef enum { CREATE_NO_STREAM, /* 作成元が無い */ CREATE_STREAM_FROM_FILE, /* ファイル名から作成 */ CREATE_STREAM_FROM_FILE_POINTER, /* ファイルポインタから作成 */ CREATE_STREAM_FROM_CHARACTERS /* 文字列(char * 型)から作成 */ } CreateStreamFrom; /*****************************************************************************/ /* 関数とメソッドの宣言(外部に公開するもの) */ /*****************************************************************************/ /*===========================================================================*/ /* オブジェクトの生成 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ Stream Stream_Create(CreateStreamFrom from, void * object); /*---------------------------------------------------------------------------*/ /* なにもないところから生成(ダミー用) */ /*---------------------------------------------------------------------------*/ Stream Stream_CreateFromNone(); /*---------------------------------------------------------------------------*/ /* ファイルから生成 */ /*---------------------------------------------------------------------------*/ Stream Stream_CreateFromFile(char * filename); /*---------------------------------------------------------------------------*/ /* ファイルポインタから生成 */ /*---------------------------------------------------------------------------*/ Stream Stream_CreateFromFilePointer(FILE * fp); /*---------------------------------------------------------------------------*/ /* 文字列(char * 型)から生成 */ /*---------------------------------------------------------------------------*/ Stream Stream_CreateFromCharacters(char * characters); /*===========================================================================*/ /* オブジェクトの消去 */ /*===========================================================================*/ int Stream_Destroy(Stream this); /*===========================================================================*/ /* 文字列の取得 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* 読み込む文字がまだあるかどうか */ /*---------------------------------------------------------------------------*/ int Stream_IsEnd(Stream this); /*---------------------------------------------------------------------------*/ /* Stream から1文字を取得(get)する. */ /*---------------------------------------------------------------------------*/ int Stream_GetCharacter(Stream this); /*---------------------------------------------------------------------------*/ /* Stream に1文字を返却(unget)する. */ /*---------------------------------------------------------------------------*/ int Stream_UngetCharacter(Stream this, int c); /*---------------------------------------------------------------------------*/ /* Stream に文字列を返却(unget)する. */ /*---------------------------------------------------------------------------*/ int Stream_UngetCharacters(Stream this, char * characters); /*---------------------------------------------------------------------------*/ /* Stream からトークンで区切って文字列を読み込み,文字列(String 型)で返す. */ /* 引用符やコメント行の解釈を行う. */ /*---------------------------------------------------------------------------*/ /* split1 は,複数の区切り文字が連続する場合にも,ヌル文字として切り分ける. */ /* split2 は,複数の区切り文字が連続する場合には,ひとつの区切り文字として */ /* 処理する. */ /*---------------------------------------------------------------------------*/ char * Stream_GetWord(Stream this, /* 読み込み元の Stream */ char * buffer, int buffer_length, char * split1, /* この文字で切り分ける */ char * split2, /* この文字でも切り分ける */ char * comment, /* コメント行の先頭文字 '#' など */ char * lineend, /* 行末文字 '\n' など */ char * quotation, /* 引用符文字 '\"' など */ char * head_skip, /* 文字列先頭の読みとばし文字 */ char * tail_skip /* 文字列末尾の読みとばし文字 */ ); /*****************************************************************************/ /* ここまで */ /*****************************************************************************/ #endif /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/main.c0100644000175000017500000002303707142030232014666 0ustar kmutokmuto/* main */ #include "configure.h" #include "XFireworks.h" #include "arguments.h" #ifndef VERSION #define VERSION "XFireworks-unknown-version" #endif #ifndef XFIREWORKS_CONF_DIRECTRY #define XFIREWORKS_CONF_DIRECTRY "/usr/X11R6/etc" #endif #ifndef DEFAULT_DISPLAY #define DEFAULT_DISPLAY NULL #endif #ifndef DEFAULT_DIRECT_DRAW #define DEFAULT_DIRECT_DRAW 1 #endif #ifndef DEFAULT_BACKGROUND_COLOR #define DEFAULT_BACKGROUND_COLOR "black" #endif #ifndef DEFAULT_FILENAME #define DEFAULT_FILENAME "xfireworks.conf" #endif #ifndef DEFAULT_STUDYING_FLAG #define DEFAULT_STUDYING_FLAG 0 #endif #ifndef DEFAULT_CACHE_FLAG #define DEFAULT_CACHE_FLAG 1 #endif #ifndef DEFAULT_CACHE_SIZE #define DEFAULT_CACHE_SIZE 10 #endif #ifndef DEFAULT_HASH_NUMBER #define DEFAULT_HASH_NUMBER 64 #endif #ifndef DEFAULT_PIECES_MAX_NUMBER #define DEFAULT_PIECES_MAX_NUMBER 100 #endif #ifndef DEFAULT_FINE #define DEFAULT_FINE 100 #endif #ifndef DEFAULT_WAIT #define DEFAULT_WAIT 0 #endif #ifndef DEFAULT_GRADATION #define DEFAULT_GRADATION 16 #endif #ifndef DEFAULT_PROBABILITY_MAGNIFICATION #define DEFAULT_PROBABILITY_MAGNIFICATION 100 #endif #ifndef DEFAULT_SIZE_MAGNIFICATION #define DEFAULT_SIZE_MAGNIFICATION 100 #endif #ifndef DEFAULT_AIR_MAGNIFICATION #define DEFAULT_AIR_MAGNIFICATION 100 #endif #ifndef DEFAULT_GRAVITY_MAGNIFICATION #define DEFAULT_GRAVITY_MAGNIFICATION 100 #endif #ifndef DEFAULT_TRANSMISSION_MAGNIFICATION #define DEFAULT_TRANSMISSION_MAGNIFICATION 100 #endif #ifndef DEFAULT_AFTER_IMAGE_MAGNIFICATION #define DEFAULT_AFTER_IMAGE_MAGNIFICATION 100 #endif #ifndef DEFAULT_COLOR_LENGTH_MAGNIFICATION #define DEFAULT_COLOR_LENGTH_MAGNIFICATION 100 #endif #ifndef DEFAULT_NEXT_POWER_MAGNIFICATION #define DEFAULT_NEXT_POWER_MAGNIFICATION 100 #endif #ifndef DEFAULT_NEXT_NUMBER_MAGNIFICATION #define DEFAULT_NEXT_NUMBER_MAGNIFICATION 100 #endif static char * display_name = DEFAULT_DISPLAY; static int direct_draw = DEFAULT_DIRECT_DRAW; static char * background_color = DEFAULT_BACKGROUND_COLOR; static char * filename = DEFAULT_FILENAME; static int studying_flag = DEFAULT_STUDYING_FLAG; static int cache_flag = DEFAULT_CACHE_FLAG; static int cache_size = DEFAULT_CACHE_SIZE; static int hash_number = DEFAULT_HASH_NUMBER; static int pieces_max_number = DEFAULT_PIECES_MAX_NUMBER; static int fine = DEFAULT_FINE; static int wait_time = DEFAULT_WAIT; static int gradation = DEFAULT_GRADATION; static int probability_magnification = DEFAULT_PROBABILITY_MAGNIFICATION; static int size_magnification = DEFAULT_SIZE_MAGNIFICATION; static int air_magnification = DEFAULT_AIR_MAGNIFICATION; static int gravity_magnification = DEFAULT_GRAVITY_MAGNIFICATION; static int transmission_magnification = DEFAULT_TRANSMISSION_MAGNIFICATION; static int after_image_magnification = DEFAULT_AFTER_IMAGE_MAGNIFICATION; static int color_length_magnification = DEFAULT_COLOR_LENGTH_MAGNIFICATION; static int next_power_magnification = DEFAULT_NEXT_POWER_MAGNIFICATION; static int next_number_magnification = DEFAULT_NEXT_NUMBER_MAGNIFICATION; void help() { printf("%s\n\n", VERSION); printf("XFireworks Copyright (c) 2000 Sakai Hiroaki.\n"); printf("All Rights Reserved.\n\n"); printf("Usage:\n"); printf(" xfireworks [options]\n\n"); printf("Options:\n"); printf(" -h, -help\n"); printf(" -display [displayname]\n"); printf(" -bg, -background, -background-color [backgroundcolor]\n"); printf(" -f, -file [filename]\n"); printf(" -wait [micro seconds]\n"); printf(" -fine [number]\n"); printf(" -gradation [number]\n"); printf(" -direct-draw, -no-direct-draw\n"); printf(" -probability, -probability-magnification [number]\n"); printf(" -size, -size-magnification [number]\n"); printf(" -air, -air-magnification [number]\n"); printf(" -gravity, -gravity-magnification [number]\n"); printf(" -transmission, -transmission-magnification [number]\n"); printf(" -after-image, -after-image-magnification [number]\n"); printf(" -color-length, -color-length-magnification [number]\n"); printf(" -next-power, -next-power-magnification [number]\n"); printf(" -next-number, -next-number-magnification [number]\n"); printf("\n"); exit (0); } Argument arguments[] = { {"-h", ARGUMENTS_FUNCTION, (void *)(&help)}, {"-help", ARGUMENTS_FUNCTION, (void *)(&help)}, {"-display", ARGUMENTS_STRING, (void *)(&display_name)}, {"-bg", ARGUMENTS_STRING, (void *)(&background_color)}, {"-background", ARGUMENTS_STRING, (void *)(&background_color)}, {"-background-color", ARGUMENTS_STRING, (void *)(&background_color)}, {"-f", ARGUMENTS_STRING, (void *)(&filename)}, {"-file", ARGUMENTS_STRING, (void *)(&filename)}, {"-wait", ARGUMENTS_INTEGER, (void *)(&wait_time)}, {"-fine", ARGUMENTS_INTEGER, (void *)(&fine)}, {"-gradation", ARGUMENTS_INTEGER, (void *)(&gradation)}, {"-direct-draw", ARGUMENTS_FLAG_ON, (void *)(&direct_draw)}, {"-no-direct-draw", ARGUMENTS_FLAG_OFF, (void *)(&direct_draw)}, {"-probability", ARGUMENTS_INTEGER, (void *)(&probability_magnification)}, {"-probability-magnification", ARGUMENTS_INTEGER, (void *)(&probability_magnification)}, {"-size", ARGUMENTS_INTEGER, (void *)(&size_magnification)}, {"-size-magnification", ARGUMENTS_INTEGER, (void *)(&size_magnification)}, {"-air", ARGUMENTS_INTEGER, (void *)(&air_magnification)}, {"-air-magnification", ARGUMENTS_INTEGER, (void *)(&air_magnification)}, {"-gravity", ARGUMENTS_INTEGER, (void *)(&gravity_magnification)}, {"-gravity-magnification", ARGUMENTS_INTEGER, (void *)(&gravity_magnification)}, {"-transmission", ARGUMENTS_INTEGER, (void *)(&transmission_magnification)}, {"-transmission-magnification", ARGUMENTS_INTEGER, (void *)(&transmission_magnification)}, {"-after-image", ARGUMENTS_INTEGER, (void *)(&after_image_magnification)}, {"-after-image-magnification", ARGUMENTS_INTEGER, (void *)(&after_image_magnification)}, {"-color-length", ARGUMENTS_INTEGER, (void *)(&color_length_magnification)}, {"-color-length-magnification", ARGUMENTS_INTEGER, (void *)(&color_length_magnification)}, {"-next-power", ARGUMENTS_INTEGER, (void *)(&next_power_magnification)}, {"-next-power-magnification", ARGUMENTS_INTEGER, (void *)(&next_power_magnification)}, {"-next-number", ARGUMENTS_INTEGER, (void *)(&next_number_magnification)}, {"-next-number-magnification", ARGUMENTS_INTEGER, (void *)(&next_number_magnification)}, /* ここから下はチューニング用の隠しオプションです */ {"-pieces-max-number",ARGUMENTS_INTEGER, (void *)(&pieces_max_number)}, /* 学習機能を利用したい場合には,以下を有効にします. */ /* 学習機能とキャッシュは併用できますが,併用してもあまり意味はありません.*/ /* 学習機能を利用すると,検索した instance をリストの先頭に持って */ /* くるようになります.これはこれで高速. */ /* 学習機能が無効だと,色をソートして格納するので,検索するときに, */ /* 色が格納されていなかったばあいに,すぐに検索を打ち切ることができるように*/ /* なります.これはこれで高速. */ {"-studying", ARGUMENTS_FLAG_ON, (void *)(&studying_flag)}, {"-no-studying", ARGUMENTS_FLAG_OFF, (void *)(&studying_flag)}, /* 以下を有効にすると,キャッシュを使用するようになります. */ {"-cache", ARGUMENTS_FLAG_ON, (void *)(&cache_flag)}, {"-no-cache", ARGUMENTS_FLAG_OFF, (void *)(&cache_flag)}, /* キャッシュのサイズを指定します. */ {"-cache-size", ARGUMENTS_INTEGER, (void *)(&cache_size)}, /* ハッシュのサイズを指定します. */ {"-hash-number", ARGUMENTS_INTEGER, (void *)(&hash_number)}, {NULL, ARGUMENTS_NONE, NULL} }; int main(int argc, char * argv[]) { XFireworks xfireworks; Arguments_Read(&argc, argv, arguments); if (cache_size < 1) cache_size = 1; if (hash_number < 1) hash_number = 1; if (fine < 1) fine = 1; if (gradation < 1) gradation = 1; if (pieces_max_number < 1) pieces_max_number = 1; if (wait_time < 0) wait_time = 0; if (probability_magnification < 0) probability_magnification = 0; if (size_magnification < 0) size_magnification = 0; if (air_magnification < 0) air_magnification = 0; if (gravity_magnification < 0) gravity_magnification = 0; if (transmission_magnification < 0) transmission_magnification = 0; if (after_image_magnification < 0) after_image_magnification = 0; if (color_length_magnification < 0) color_length_magnification = 0; if (next_power_magnification < 0) next_power_magnification = 0; if (next_number_magnification < 0) next_number_magnification = 0; xfireworks = XFireworks_Create(display_name, direct_draw, background_color, XFIREWORKS_CONF_DIRECTRY, filename, studying_flag, cache_flag, cache_size, hash_number, fine, gradation, probability_magnification, size_magnification, air_magnification, gravity_magnification, transmission_magnification, after_image_magnification, color_length_magnification, next_power_magnification, next_number_magnification); XFireworks_Start(xfireworks, pieces_max_number, wait_time); XFireworks_Destroy(xfireworks); exit (0); } /* End of Program */ xfireworks-1.3.orig/Calculator.c0100644000175000017500000000245107142030232016030 0ustar kmutokmuto#include "CalculatorP.h" #include #ifndef M_PI #define M_PI 3.14159265358979 #endif #include "etc.h" Calculator Calculator_Create(int degree_number) { Calculator cal; int i; cal = (Calculator)malloc(sizeof(_Calculator)); if (!cal) Error("Calculator_Create", "Cannot allocate memory."); cal->degree_number = degree_number; cal->sine = (double *)malloc(sizeof(double) * cal->degree_number); if (!cal->sine) Error("Calculator_Create", "Cannot allocate memory."); for (i = 0; i < cal->degree_number; i++) { cal->sine[i] = sin(i * (360.0 / cal->degree_number * M_PI / 180.0)); } return (cal); } Calculator Calculator_Destroy(Calculator cal) { if (!cal) return (NULL); if (cal->sine) free(cal->sine); free(cal); return (NULL); } double Calculator_GetSin(Calculator cal, int degree) { while (degree < 0) degree += cal->degree_number; degree = degree % cal->degree_number; return (cal->sine[degree]); } double Calculator_GetCos(Calculator cal, int degree) { return (Calculator_GetSin(cal, cal->degree_number / 4 - degree)); } /*****************************************************************************/ /* End of Program */ /*****************************************************************************/ xfireworks-1.3.orig/Calculator.h0100644000175000017500000000112707142030233016035 0ustar kmutokmuto#ifndef _Calculator_h_INCLUDED_ #define _Calculator_h_INCLUDED_ typedef struct _Calculator * Calculator; #define CALCULATOR_DEFAULT_DEGREE 360 Calculator Calculator_Create(int degree_number); Calculator Calculator_Destroy(Calculator cal); double Calculator_GetSin(Calculator cal, int degree); double Calculator_GetCos(Calculator cal, int degree); #endif /*****************************************************************************/ /* End of Program */ /*****************************************************************************/ xfireworks-1.3.orig/StreamP.h0100644000175000017500000001100507142030233015313 0ustar kmutokmuto/*****************************************************************************/ /* Stream Class Library Copyright (c) 1999-2000 Sakai Hiroaki. */ /* All Rights Reserved. */ /*===========================================================================*/ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2, or (at your option) */ /* any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; see the file COPYING. If not, write to */ /* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /*****************************************************************************/ #ifndef _STREAMP_H_INCLUDED_ #define _STREAMP_H_INCLUDED_ /*****************************************************************************/ /* ここから */ /*****************************************************************************/ #include "Stream.h" /*****************************************************************************/ /* ヘッダファイルのインクルード(プライベートなもの) */ /*****************************************************************************/ /* None */ /*****************************************************************************/ /* 型の定義(外部に公開しないもの) */ /*****************************************************************************/ /*===========================================================================*/ /* 読み込み元の本体のタイプ */ /*===========================================================================*/ typedef enum { STREAM_TYPE_NONE, /* 読み込み元が無い */ STREAM_TYPE_FILE_POINTER, /* ファイルポインタから読み込む */ STREAM_TYPE_CHARACTERS /* 文字列(char * 型)から読み込む */ } StreamType; /*===========================================================================*/ /* 読み込み元の本体 */ /*===========================================================================*/ typedef union { void * dummy; /* 読み込み元が無い */ FILE * file_pointer; /* ファイルポインタから読み込む */ char * characters; /* 文字列(char * 型)から読み込む */ } StreamObject; /*===========================================================================*/ /* unget 用バッファ */ /*===========================================================================*/ typedef struct _UngetBuffer { char character; struct _UngetBuffer * next; } UngetBuffer; /*===========================================================================*/ /* Stream クラスの本体 */ /*===========================================================================*/ typedef struct _Stream { UngetBuffer * unget_buffer; /* バッファ(何文字でも unget できる) */ int end_flag; /* 終了のフラグ(読み込むものが無いとき真) */ CreateStreamFrom from; /* 作成元のオブジェクトのタイプ(ファイル名,文字列など) */ StreamType type; /* 読み込み元の本体のタイプ(ファイル,String 型など) */ StreamObject object; /* 読み込み元の本体(ファイル,String 型など) */ } _Stream; /*****************************************************************************/ /* ここまで */ /*****************************************************************************/ #endif /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/AfterImageP.h0100644000175000017500000000162407142030233016072 0ustar kmutokmuto#ifndef _XFIREWORKS_AfterImageP_h_INCLUDED_ #define _XFIREWORKS_AfterImageP_h_INCLUDED_ #include "AfterImage.h" typedef struct _AfterImages { int array_size; /* 配列のサイズ */ int number; /* 残像の数(メインループでの malloc() の呼び出し数を減らすため, */ /* AfterImage オブジェクトは使い回しするので,size != number になる */ /* 場合がある) */ XArc * arcs; /* 残像の配列.XFillArcs()でまとめて描画できるように,XArc の配列にする */ ObjList list; /* 残像の色変化(だんだん背景色に近付いていく)のリスト*/ ObjListData current; /* 残像の現在の色(listメンバ中の位置)を示す */ } _AfterImages; #endif /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/DispP.h0100644000175000017500000000140707142030233014764 0ustar kmutokmuto#ifndef _XFIREWORKS_DispP_h_INCLUDED_ #define _XFIREWORKS_DispP_h_INCLUDED_ #include "Disp.h" typedef struct _Disp { Display * display; int screen; Window root_window; Pixmap pixmap; Colormap colormap; int width, height; unsigned int depth; int direct_draw; } _Disp; /*****************************************************************************/ /* ここまで */ /*****************************************************************************/ #endif /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/Makefile0100644000175000017500000000501707142030233015235 0ustar kmutokmutoVERSION = XFireworks-1.3 PKGNAME = xfireworks-1.3 PREFIX = /usr/X11R6 X11BASE = /usr/X11R6 BINDIR = $(PREFIX)/bin LIBDIR = $(PREFIX)/etc MANDIR = $(PREFIX)/man/man1 XINCLUDEDIR = $(X11BASE)/include XLIBDIR = $(X11BASE)/lib CFLAGS = -O LFLAGS = -lm -lX11 CC = cc CP = cp RM = rm -f MKDIR = mkdir -p RMDIR = rmdir CHMOD = chmod XFIREWORKS_CONF_DIRECTRY = $(LIBDIR) OBJS = main.o AfterImage.o Disp.o ColorGC.o Obj.o Stream.o Piece.o XFireworks.o Calculator.o etc.o arguments.o all : xfireworks manual xfireworks : $(OBJS) $(CC) -o xfireworks $(OBJS) -L$(XLIBDIR) $(CFLAGS) $(LFLAGS) main.o : main.c $(CC) -c main.c $(CFLAGS) \ -DVERSION=\"$(VERSION)\" \ -DXFIREWORKS_CONF_DIRECTRY=\"$(XFIREWORKS_CONF_DIRECTRY)\" AfterImage.o : AfterImage.c $(CC) -c AfterImage.c -I$(XINCLUDEDIR) $(CFLAGS) Disp.o : Disp.c $(CC) -c Disp.c -I$(XINCLUDEDIR) $(CFLAGS) ColorGC.o : ColorGC.c $(CC) -c ColorGC.c -I$(XINCLUDEDIR) $(CFLAGS) Obj.o : Obj.c $(CC) -c Obj.c $(CFLAGS) Stream.o : Stream.c $(CC) -c Stream.c $(CFLAGS) Calculator.o : Calculator.c $(CC) -c Calculator.c $(CFLAGS) Piece.o : Piece.c $(CC) -c Piece.c -I$(XINCLUDEDIR) $(CFLAGS) XFireworks.o : XFireworks.c xfireworks_conf.h $(CC) -c XFireworks.c -I$(XINCLUDEDIR) $(CFLAGS) xfireworks_conf.h : xfireworks.conf mkconf cat xfireworks.conf | ./mkconf > xfireworks_conf.h mkconf : mkconf.c $(CC) mkconf.c -o mkconf etc.o : etc.c $(CC) -c etc.c $(CFLAGS) arguments.o : arguments.c $(CC) -c arguments.c $(CFLAGS) manual : xfireworks.1.gz xfireworks.1.gz : xfireworks.1 cat xfireworks.1 | gzip > xfireworks.1.gz clean : $(RM) *.o xfireworks xfireworks_conf.h mkconf xfireworks.1.gz install : install-bin install-lib install-man install-bin : xfireworks $(MKDIR) $(BINDIR) $(CP) xfireworks $(BINDIR) $(CHMOD) 0755 $(BINDIR)/xfireworks install-lib : $(MKDIR) $(LIBDIR) $(CP) xfireworks.conf $(LIBDIR) $(CHMOD) 0644 $(LIBDIR)/xfireworks.conf install-man : manual $(MKDIR) $(MANDIR) $(CP) xfireworks.1.gz $(MANDIR) $(CHMOD) 0444 $(MANDIR)/xfireworks.1.gz uninstall : uninstall-bin uninstall-lib uninstall-man uninstall-bin : $(RM) $(BINDIR)/xfireworks uninstall-lib : $(RM) $(LIBDIR)/xfireworks.conf uninstall-man : $(RM) $(MANDIR)/xfireworks.1.gz package : $(MKDIR) $(PKGNAME) $(RM) $(PKGNAME)/* $(CP) AUTHORS COPYING COPYRIGHT ChangeLog HISTORY INSTALL \ NEWS README OMAKE.jpn Makefile xfireworks.conf \ xfireworks.1 *.h *.c $(PKGNAME) $(RM) $(PKGNAME)/xfireworks_conf.h tar cvzf $(PKGNAME).tar.gz $(PKGNAME) # End of Makefile. xfireworks-1.3.orig/HISTORY0100644000175000017500000000300607142030233014655 0ustar kmutokmuto■ XFireworks-1.3 での変更点 使用が終った Pieces オブジェクトと AfterImages オブジェクトをリスト管理し, 再利用することにより,メインループ中での malloc() 呼び出しを減らした. (XFireworks クラスの free_pieces_list, free_after_images_list メンバ参照) 負荷を抑えるための修正だが,あまり効果はないようだった. Obj.c の ObjList_IsEnd() にバグあり.修正. Makefile の install-bin, install-lib, install-man ターゲットに $(MKDIR) を追加した. (PREFIX = /usr/local だと,/usr/local/etc が存在しない場合があるので) ■ XFireworks-1.2 での変更点 Color "red red 10" のようなとき,XPerseColor() が2回呼ばれるのは無駄なので, ColorName クラス,ColorNameList クラスを新規に追加し, 色名をリスト管理して,XPerseColor() が呼ばれる回数を減らした. → 起動時間が半分くらいになったと思う.わりと効果はあった. Pieces オブジェクトの生成時の, x = (double *)malloc(sizeof(double) * n); y = (double *)malloc(sizeof(double) * n); z = (double *)malloc(sizeof(double) * n); のようなのを, x = (double *)malloc(sizeof(double) * n * 3); y = x + n; z = x + 2 * n; のようにしてまとめて,メインループ内での malloc() を減らして負荷を下げた. → 言われてみると,多少下がったかも... というくらい. 設定ファイルの置き場所を, /usr/X11R6/lib/X11/XFireworks から /usr/X11R6/etc に変更. Makefile 中の,マニュアル(xfireworks.1.gz)の生成方法を修正. ■ XFireworks-1.1 での変更点 sic,cos を計算するための Calculate クラスを作り,sin,cos を配列化して 負荷を下げた. Pieces_Move() での冗長な計算をループ外に出して,負荷を下げた. ■ XFireworks-1.0 での変更点 新規作成. xfireworks-1.3.orig/AfterImage.c0100644000175000017500000000722407142030232015746 0ustar kmutokmuto#include "AfterImageP.h" #include "etc.h" #include "ColorGC.h" /*===========================================================================*/ /* メンバの取得 */ /*===========================================================================*/ int AfterImages_GetArraySize(AfterImages after_images) { return (after_images->array_size); } int AfterImages_GetNumber(AfterImages after_images) { return (after_images->number); } XArc * AfterImages_GetArcs(AfterImages after_images) { return (after_images->arcs); } /*===========================================================================*/ /* オブジェクトの生成と削除 */ /*===========================================================================*/ int AfterImages_Initialize(AfterImages after_images, int size, int number, double * x, double * y, int x_min, int y_min, int x_max, int y_max, ObjList list) { int i, n, r; if (number > after_images->array_size) return (1); r = size / 2; n = 0; for (i = 0; i < number; i++) { if ((x[i] < x_min) || (x[i] > x_max) || (y[i] > y_max)) { continue; } after_images->arcs[n].x = x[i] - r; after_images->arcs[n].y = y[i] - r; after_images->arcs[n].width = size; after_images->arcs[n].height = size; after_images->arcs[n].angle1 = 0; after_images->arcs[n].angle2 = 360*64; n++; } after_images->number = n; after_images->list = list; after_images->current = ObjList_GetStartEdge(after_images->list); return (0); } AfterImages AfterImages_Create(int size, int number, double * x, double * y, int x_min, int y_min, int x_max, int y_max, ObjList list) { AfterImages after_images; after_images = (AfterImages)malloc(sizeof(_AfterImages)); if (after_images == NULL) Error("AfterImages_Create", "Cannot allocate memory"); after_images->array_size = number; /* AfterImages オブジェクトは使い回しするので,小さいサイズのものは */ /* メモリを無駄に食ってしまうので,メモリの節約のため,あまり小さな */ /* サイズのものは作らないようにする. */ if (after_images->array_size < 30) after_images->array_size = 30; if (after_images->array_size) { after_images->arcs = (XArc *)malloc(sizeof(XArc) * after_images->array_size); if (after_images->arcs == NULL) Error("AfterImages_Create", "Cannot allocate memory"); } else after_images->arcs = NULL; AfterImages_Initialize(after_images, size, number, x, y, x_min, y_min, x_max, y_max, list); return (after_images); } AfterImages AfterImages_Destroy(AfterImages after_images) { if (!after_images) return (NULL); if (after_images->arcs) free(after_images->arcs); free(after_images); return (NULL); } /*===========================================================================*/ /* 現在の色の値をGCで返し,current を一つ先に進める.(最後には NULL を返す) */ /*===========================================================================*/ GC AfterImages_GetGC(AfterImages after_images) { ColorGC color_gc; GC gc; if (after_images->current == NULL) return (NULL); if (ObjList_IsEnd(after_images->list, after_images->current)) return (NULL); after_images->current = ObjListData_GetNext(after_images->current); color_gc = (ColorGC)ObjListData_GetObj(after_images->current); gc = ColorGC_GetGC(color_gc); return (gc); } /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/AfterImage.h0100644000175000017500000000370507142030233015754 0ustar kmutokmuto/*****************************************************************************/ /* 花火の玉の残像を扱うクラス */ /*****************************************************************************/ #ifndef _XFIREWORKS_AfterImage_h_INCLUDED_ #define _XFIREWORKS_AfterImage_h_INCLUDED_ typedef struct _AfterImages * AfterImages; #include #include "Obj.h" /*===========================================================================*/ /* メンバの取得 */ /*===========================================================================*/ int AfterImages_GetArraySize(AfterImages after_images); int AfterImages_GetNumber(AfterImages after_images); XArc * AfterImages_GetArcs(AfterImages after_images); /*===========================================================================*/ /* オブジェクトの生成と削除 */ /*===========================================================================*/ int AfterImages_Initialize(AfterImages after_images, int size, int number, double * x, double * y, int x_min, int y_min, int x_max, int y_max, ObjList list); AfterImages AfterImages_Create(int size, int number, double * x, double * y, int x_min, int y_min, int x_max, int y_max, ObjList list); AfterImages AfterImages_Destroy(AfterImages after_images); /*===========================================================================*/ /* 現在の色の値をGCで返し,current を一つ先に進める.(最後には NULL を返す) */ /*===========================================================================*/ GC AfterImages_GetGC(AfterImages after_images); #endif /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/INSTALL0100644000175000017500000000262107142030233014624 0ustar kmutokmuto* Easy install If you want to install xfireworks, operate as below. 1. Type "make" to compile xfireworks. If you type "make", xfireworks and manual are made. But, you need gzip to make the manual. If you have not installed gzip, type "make xfireworks" to make only xfireworks. Normally, header files and libraries of X are searched in /usr/X11R6. If they are installed to other directry on your system, edit Makefile and modify X11BASE. 2. Type "make install" to install the program, data, and manual. If you don't make the manual, type "make install-bin ; make install-lib". Normally, XFireworks is installed to /usr/X11R6. If you want to install XFireworks to the directry as you like, edit Makefile and modify PREFIX, BINDIR, LIBDIR, and MANDIR. * For Solaris If you want to compile xfireworks on Solaris or SunOS, you may edit Makefile and add -lsocket option to LFLAGS. For example, LFLAGS = -lm -lX11 -lsocket * Uninstall If you want to remove xfireworks, operate as below. 1. Type "make uninstall" to remove the program, data, and manual. If you haven't installed the manual, type "make uninstall-bin ; make uninstall-lib". * Customizing xfireworks If you want to customize xfireworks, edit Makefile and configure.h. * Making fireworks You can edit xfireworks.conf to make your original fireworks. If you make original fireworks, please send them to the author! xfireworks-1.3.orig/XFireworks.c0100644000175000017500000003652207142030232016050 0ustar kmutokmuto#include "XFireworksP.h" #include #include "etc.h" #include "Piece.h" #include "AfterImage.h" #include "xfireworks_conf.h" /*===========================================================================*/ /* 内部で使用する関数 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* コンフィギュレーション用のファイルを探し,無ければデフォルトのデータを */ /* 読み込む. */ /*---------------------------------------------------------------------------*/ static Stream Stream_CreateFromFileOrCharacters(char * dirname, char * filename, char * default_xfireworks_conf) { Stream stream; char * work; stream = Stream_CreateFromFile(filename); if (stream != NULL) return (stream); /* dirname が "" だったときに,./[filename] のようなファイルも */ /* 調べるので,1 ではなく 3 を加えている. */ work = (char *)malloc(sizeof(char) * (StringLen(dirname) + StringLen(filename) + 3)); StringCpy(work, "./"); StringCat(work, filename); stream = Stream_CreateFromFile(work); if (stream != NULL) goto stream_return; StringCpy(work, dirname); StringCat(work, "/"); StringCat(work, filename); stream = Stream_CreateFromFile(work); if (stream != NULL) goto stream_return; stream = Stream_CreateFromCharacters(default_xfireworks_conf); stream_return: free(work); return (stream); } /*===========================================================================*/ /* オブジェクトの生成と削除 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ XFireworks XFireworks_Create(char * display_name, int direct_draw, char * background_color, char * dirname, char * filename, int studying_flag, int cache_flag, int cache_size, int hash_number, int fine, int gradation, int probability_magnification, int size_magnification, int air_magnification, int gravity_magnification, int transmission_magnification, int after_image_magnification, int color_length_magnification, int next_power_magnification, int next_number_magnification) { XFireworks xfireworks; Stream stream; ColorGC color_gc; xfireworks = (XFireworks)malloc(sizeof(_XFireworks)); if (!xfireworks) Error("XFireworks_Create", "Cannot allocate mamory"); /* 乱数初期化 */ InitializeRand(); /* ディスプレイ初期化 */ xfireworks->disp = Disp_Create(display_name, direct_draw); /* GCのデータベース初期化 */ xfireworks->color_gc_database = ColorGCDatabase_Create(xfireworks->disp, studying_flag, cache_flag, cache_size, hash_number, background_color, gradation); /* ディスプレイのクリア */ color_gc = ColorGCDatabase_GetBackgroundColorGC(xfireworks->color_gc_database); if (!direct_draw) Disp_ClearPixmap(xfireworks->disp, ColorGC_GetGC(color_gc)); Disp_ClearDisplay(xfireworks->disp, ColorGC_GetPixel(color_gc)); /* PieceClass の読み込み */ stream = Stream_CreateFromFileOrCharacters(dirname, filename, default_xfireworks_conf); xfireworks->piece_class_list = PieceClassList_CreateFromStream(xfireworks->disp, xfireworks->color_gc_database, stream, fine, probability_magnification, size_magnification, air_magnification, gravity_magnification, transmission_magnification, after_image_magnification, color_length_magnification, next_power_magnification, next_number_magnification); Stream_Destroy(stream); xfireworks->pieces_list = ObjList_Create(); xfireworks->free_pieces_list = ObjList_Create(); xfireworks->after_images_list = ObjList_Create(); xfireworks->free_after_images_list = ObjList_Create(); /* ハッシュの利用度表示(チューニング用) */ #ifdef OUTPUT_HASH_STATUS ColorGCDatabase_OutputHashStatus(xfireworks->color_gc_database); #endif xfireworks->calculator = Calculator_Create(CALCULATOR_DEFAULT_DEGREE); return (xfireworks); } /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ XFireworks XFireworks_Destroy(XFireworks xfireworks) { ColorGC color_gc; if (!xfireworks) return (NULL); /* ディスプレイのクリア */ color_gc = ColorGCDatabase_GetBackgroundColorGC(xfireworks->color_gc_database); Disp_ClearDisplay(xfireworks->disp, ColorGC_GetPixel(color_gc)); if (xfireworks->calculator) Calculator_Destroy(xfireworks->calculator); if (xfireworks->free_after_images_list) ObjList_Destroy(xfireworks->free_after_images_list); if (xfireworks->after_images_list) ObjList_Destroy(xfireworks->after_images_list); if (xfireworks->free_pieces_list) ObjList_Destroy(xfireworks->free_pieces_list); if (xfireworks->pieces_list) ObjList_Destroy(xfireworks->pieces_list); if (xfireworks->piece_class_list) ObjList_Destroy(xfireworks->piece_class_list); if (xfireworks->color_gc_database) ColorGCDatabase_Destroy(xfireworks->color_gc_database); if (xfireworks->disp) Disp_Destroy(xfireworks->disp); free(xfireworks); return (NULL); } /*===========================================================================*/ /* 花火のスタート */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* PieceClass を表示(デバッグ用) */ /*---------------------------------------------------------------------------*/ static int XFireworks_DrawAllPieceClasses(XFireworks xfireworks) { PieceClass piece_class; ObjList gc_list_list; ObjList gc_list; ObjListData a, b, c; GC gc; int x, y; x = 10; y = 10; for (a = ObjList_GetStart(xfireworks->piece_class_list); !ObjList_IsEndEdge(xfireworks->piece_class_list, a); a = ObjListData_GetNext(a)) { piece_class = (PieceClass)ObjListData_GetObj(a); gc_list_list = PieceClass_GetGCListList(piece_class); for (b = ObjList_GetStart(gc_list_list); !ObjList_IsEndEdge(gc_list_list, b); b = ObjListData_GetNext(b)) { gc_list = ObjListData_GetObj(b); x = 10; for (c = ObjList_GetStart(gc_list); !ObjList_IsEndEdge(gc_list, c); c = ObjListData_GetNext(c)) { gc = ColorGC_GetGC(ObjListData_GetObj(c)); Disp_DrawFilledCircle(xfireworks->disp, gc, x, y, 5); Disp_Flush(xfireworks->disp); x += 10; } y += 10; } } return (0); } /*---------------------------------------------------------------------------*/ /* シグナル処理 */ /*---------------------------------------------------------------------------*/ static int end_flag; static void InterruptTrap(int n) { end_flag = 1; } /*---------------------------------------------------------------------------*/ /* 未使用の Pieces のリストから,使える Pieces オブジェクトを検索し, */ /* 初期化する.見つからなかった場合には,create する. */ /*---------------------------------------------------------------------------*/ static int SearchOrCreateUsablePieces(XFireworks xfireworks, PieceClass piece_class, double power, int number, int n, double * x, double * y, double * z, double * vx, double * vy, double * vz, int x_min, int y_min, int x_max, int y_max) { Pieces pieces; ObjListData current; for (current = ObjList_GetStart(xfireworks->free_pieces_list); !ObjList_IsEndEdge(xfireworks->free_pieces_list, current); current = ObjListData_GetNext(current)) { pieces = (Pieces)ObjListData_GetObj(current); if (Pieces_GetArraySize(pieces) >= number * n) { Pieces_Initialize(pieces, piece_class, power, number, n, x, y, z, vx, vy, vz, x_min, y_min, x_max, y_max, xfireworks->calculator); ObjList_MoveObjToEndOfOtherList(xfireworks->free_pieces_list, current, xfireworks->pieces_list); return (0); } } /* 使用できる Pieces オブジェクトが無かったら,新しく生成する */ pieces = Pieces_Create(piece_class, power, number, n, x, y, z, vx, vy, vz, x_min, y_min, x_max, y_max, xfireworks->calculator); if (pieces == NULL) return (0); ObjList_InsertObjToEnd(xfireworks->pieces_list, pieces, (ObjDestructor)Pieces_Destroy); return (1); } /*---------------------------------------------------------------------------*/ /* 未使用の AfterImages のリストから,使える AfterImages オブジェクトを */ /* 検索し,初期化する.見つからなかった場合には,create する. */ /*---------------------------------------------------------------------------*/ static int SearchOrCreateUsableAfterImages(XFireworks xfireworks, int size, int number, double * x, double * y, int x_min, int y_min, int x_max, int y_max, ObjList list) { AfterImages after_images; ObjListData current; for (current = ObjList_GetStart(xfireworks->free_after_images_list); !ObjList_IsEndEdge(xfireworks->free_after_images_list, current); current = ObjListData_GetNext(current)) { after_images = (AfterImages)ObjListData_GetObj(current); if (AfterImages_GetArraySize(after_images) >= number) { AfterImages_Initialize(after_images, size, number, x, y, x_min, y_min, x_max, y_max, list); ObjList_MoveObjToEndOfOtherList(xfireworks->free_after_images_list, current, xfireworks->after_images_list); return (0); } } /* 使用できる AfterImages オブジェクトが無かったら,新しく生成する */ after_images = AfterImages_Create(size, number, x, y, x_min, y_min, x_max, y_max, list); if (after_images == NULL) return (0); ObjList_InsertObjToEnd(xfireworks->after_images_list, after_images, (ObjDestructor)AfterImages_Destroy); return (1); } /*---------------------------------------------------------------------------*/ /* 花火のスタート */ /*---------------------------------------------------------------------------*/ int XFireworks_Start(XFireworks xfireworks, int pieces_max_number, int wait_time) { PieceClass piece_class; PieceNext piece_next; Pieces pieces; Pieces pieces2; ObjList next_list; ObjListData current; ObjListData current2; AfterImages after_images; double x, y, z, vx, vy, vz; GC gc; int ret; #if 0 XFireworks_DrawAllPieceClasses(xfireworks); while(1) { /* None */ } #endif end_flag = 0; signal(SIGINT , InterruptTrap); signal(SIGTERM, InterruptTrap); while (end_flag == 0) { /* 新しい Pieces の生成 */ if (ObjList_GetLength(xfireworks->pieces_list) < pieces_max_number) { for (current = ObjList_GetStart(xfireworks->piece_class_list); !ObjList_IsEndEdge(xfireworks->piece_class_list, current); current = ObjListData_GetNext(current)) { piece_class = (PieceClass)ObjListData_GetObj(current); if (PieceClass_GetProbability(piece_class) > 0.0) { if (PieceClass_GetProbability(piece_class) > DoubleRand(100.0)) { x = (double)Rand(Disp_GetWidth( xfireworks->disp)); y = (double)Rand(Disp_GetHeight(xfireworks->disp)); z = DoubleRand(400.0) - 200.0; vx = 0.0; vy = 0.0; vz = 0.0; y -= Disp_GetHeight(xfireworks->disp) * 0.25; SearchOrCreateUsablePieces(xfireworks, piece_class, 0.0, 1, 1, &x, &y, &z, &vx, &vy, &vz, 0, 0, Disp_GetWidth( xfireworks->disp) - 1, Disp_GetHeight(xfireworks->disp) - 1); } } } } /* Pieces の処理 */ for (current = ObjList_GetStart(xfireworks->pieces_list); !ObjList_IsEndEdge(xfireworks->pieces_list, current); current = ObjListData_GetNext(current)) { pieces = (Pieces)ObjListData_GetObj(current); piece_class = Pieces_GetPieceClass(pieces); ret = Pieces_Move(pieces, 0, 0, Disp_GetWidth( xfireworks->disp) - 1, Disp_GetHeight(xfireworks->disp) - 1, Disp_GetWidth( xfireworks->disp)); if (ret) { /* 燃え尽きた場合 */ next_list = PieceClass_GetNextList(piece_class); if ((Pieces_GetNumber(pieces) > 0) && (next_list != NULL)) { for (current2 = ObjList_GetStart(next_list); !ObjList_IsEndEdge(next_list, current2); current2 = ObjListData_GetNext(current2)) { piece_next = (PieceNext)ObjListData_GetObj(current2); SearchOrCreateUsablePieces(xfireworks, PieceNext_GetPieceClass(piece_next), PieceNext_GetPower(piece_next), PieceNext_GetNumber(piece_next), Pieces_GetNumber(pieces), Pieces_GetX(pieces), Pieces_GetY(pieces), Pieces_GetZ(pieces), Pieces_GetVx(pieces), Pieces_GetVy(pieces), Pieces_GetVz(pieces), 0, 0, Disp_GetWidth( xfireworks->disp) - 1, Disp_GetHeight(xfireworks->disp) - 1); } } current2 = ObjListData_GetPrev(current); ObjList_MoveObjToStartOfOtherList(xfireworks->pieces_list, current, xfireworks->free_pieces_list); current = current2; } else { SearchOrCreateUsableAfterImages(xfireworks, Pieces_GetSize(pieces), Pieces_GetNumber(pieces), Pieces_GetX(pieces), Pieces_GetY(pieces), 0, 0, Disp_GetWidth( xfireworks->disp) - 1, Disp_GetHeight(xfireworks->disp) - 1, Pieces_GetGCList(pieces)); } } /* 残像の処理 */ for (current = ObjList_GetStart(xfireworks->after_images_list); !ObjList_IsEndEdge(xfireworks->after_images_list, current); current = ObjListData_GetNext(current)) { after_images = (AfterImages)ObjListData_GetObj(current); gc = AfterImages_GetGC(after_images); if (gc == NULL) { current2 = ObjListData_GetPrev(current); ObjList_MoveObjToStartOfOtherList(xfireworks->after_images_list, current, xfireworks->free_after_images_list); current = current2; } else { if (AfterImages_GetNumber(after_images) > 0) Disp_DrawFilledCircles(xfireworks->disp, gc, AfterImages_GetArcs(after_images), AfterImages_GetNumber(after_images)); /* X サーバに連続で負荷を与えないためのウエイト */ #if 0 usleep(10); #endif } } /* Xサーバに仕事をしてもらい, */ /* Xサーバが仕事を完了するのを待つ */ Disp_Sync(xfireworks->disp); /* usleep() は Disp_Sync() の後に置くこと. */ /* (Disp_Sync() ではXサーバの仕事完了待ちでブロックするので, */ /* Disp_Sync() の前に usleep() を置いてもあまり意味が無い) */ usleep(1000 + wait_time); } return (0); } /*****************************************************************************/ /* End of File. */ /*****************************************************************************/ xfireworks-1.3.orig/XFireworks.h0100644000175000017500000000424007142030233016046 0ustar kmutokmuto#ifndef _XFIREWORKS_XFireworks_h_INCLUDED_ #define _XFIREWORKS_XFireworks_h_INCLUDED_ typedef struct _XFireworks * XFireworks; #include #include /*===========================================================================*/ /* オブジェクトの生成と削除 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ XFireworks XFireworks_Create(char * display_name, int direct_draw, char * background_color, char * dirname, char * filename, int studying_flag, int cache_flag, int cache_size, int hash_number, int fine, int gradation, int probability_magnification, int size_magnification, int air_magnification, int gravity_magnification, int transmission_magnification, int after_image_magnification, int color_length_magnification, int next_power_magnification, int next_number_magnification); /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ XFireworks XFireworks_Destroy(XFireworks xfireworks); /*===========================================================================*/ /* 花火のスタート */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* 花火のスタート */ /*---------------------------------------------------------------------------*/ int XFireworks_Start(XFireworks xfireworks, int pieces_max_number, int wait_time); #endif /* _XFIREWORKS_XFireworks_h_INCLUDED_ */ xfireworks-1.3.orig/ColorGC.c0100644000175000017500000007275207142030232015242 0ustar kmutokmuto/*****************************************************************************/ /* ColorGC GCと色の管理・問い合わせ用のライブラリ */ /*****************************************************************************/ #include "ColorGCP.h" #include "Stream.h" #include "etc.h" /*===========================================================================*/ /* ColorGCInstance 関連 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの作成 */ /*---------------------------------------------------------------------------*/ static ColorGCInstance ColorGCInstance_Create(Disp disp, XColor color) { ColorGCInstance instance; instance = (ColorGCInstance)malloc(sizeof(_ColorGCInstance)); if (instance == NULL) Error("ColorGCInstance_Create", "Cannot allocate memory"); instance->disp = disp; instance->color = color; XAllocColor(Disp_GetDisplay(instance->disp), Disp_GetColormap(instance->disp), &(instance->color)); /* XAllocColor で instance->color.red などの内容が変わってしまうので, */ /* もとに戻す.でないと,あとで同じ色をRGB値で検索しても,違った色として */ /* 解釈されてしまい,検索できないので,色情報を保存する意味が無くなって */ /* しまう. */ instance->color.red = color.red; instance->color.green = color.green; instance->color.blue = color.blue; instance->gc = Disp_CreateGC(instance->disp); XSetForeground(Disp_GetDisplay(instance->disp), instance->gc, instance->color.pixel); XSetBackground(Disp_GetDisplay(instance->disp), instance->gc, instance->color.pixel); return (instance); } /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ static ColorGCInstance ColorGCInstance_Destroy(ColorGCInstance instance) { unsigned long pixel; if (instance == NULL) return (NULL); if (instance->gc) Disp_DestroyGC(instance->disp, instance->gc); pixel = instance->color.pixel; XFreeColors(Disp_GetDisplay(instance->disp), Disp_GetColormap(instance->disp), &pixel, 1, 0); free(instance); return (NULL); } /*===========================================================================*/ /* ColorGCList 関連 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの作成 */ /*---------------------------------------------------------------------------*/ static ColorGCList ColorGCList_Create(Disp disp, int studying_flag) { ColorGCList list; list = (ColorGCList)malloc(sizeof(_ColorGCList)); if (list == NULL) Error("ColorGCList_Create", "Cannot allocate memory"); list->disp = disp; list->studying_flag = studying_flag; list->list = ObjList_Create(); return (list); } /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ static ColorGCList ColorGCList_Destroy(ColorGCList list) { if (list == NULL) return (NULL); if (list->list) ObjList_Destroy(list->list); free(list); return (NULL); } /*---------------------------------------------------------------------------*/ /* ColorGCList 中での ColorGCInstance のソート用の比較関数 */ /*---------------------------------------------------------------------------*/ static int ColorGCInstance_CmpToColor(ColorGCInstance gci, XColor color) { if (gci->color.red > color.red ) return ( 1); if (gci->color.red < color.red ) return (-1); if (gci->color.green > color.green) return ( 1); if (gci->color.green < color.green) return (-1); if (gci->color.blue > color.blue ) return ( 1); if (gci->color.blue < color.blue ) return (-1); return (0); } /*---------------------------------------------------------------------------*/ /* リストから ColorGCInstance を得る. */ /* GC の取得要求に対して,GC のリストを検索して返す. */ /* 引数 current で,検索のスタート地点を指定する. */ /* 存在しない場合には,作成してリストに追加する. */ /* (常に RGB 値でソートされた状態で追加する) */ /* 線形探索なので,O(n^2)で遅くなる. */ /*---------------------------------------------------------------------------*/ static ColorGCInstance ColorGCList_GetColorGCInstance(ColorGCList list, XColor color) { ColorGCInstance instance; ObjListData current; int cmp; for (current = ObjList_GetStart(list->list); !ObjList_IsEndEdge(list->list, current); current = ObjListData_GetNext(current)) { instance = (ColorGCInstance)ObjListData_GetObj(current); cmp = ColorGCInstance_CmpToColor(instance, color); if (cmp == 0) { /* 見つかれば,それを返す */ #ifdef HIT_LIST fprintf(stderr, "S"); #endif if (list->studying_flag) ObjList_MoveObjToStart(list->list, current); return (instance); } else if (cmp > 0) { if (!list->studying_flag) break; } } /* 見つからなかった場合は,作成してリストに追加する */ instance = ColorGCInstance_Create(list->disp, color); if (list->studying_flag) ObjList_InsertObjToStart(list->list, instance, (ObjDestructor)ColorGCInstance_Destroy); else ObjList_InsertObjToPrev(list->list, current, instance, (ObjDestructor)ColorGCInstance_Destroy); #ifdef HIT_LIST fprintf(stderr, "A"); #endif return (instance); } /*===========================================================================*/ /* ColorGCCache 関連 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* キャッシュ用バッファ */ /*---------------------------------------------------------------------------*/ static ColorGCCacheBuffer ColorGCCacheBuffer_Create(ColorGCInstance instance) { ColorGCCacheBuffer buffer; buffer = (ColorGCCacheBuffer)malloc(sizeof(_ColorGCCacheBuffer)); if (buffer == NULL) Error("ColorGCCacheBuffer_Create", "Cannot allocate memory."); buffer->instance = instance; return (buffer); } static ColorGCCacheBuffer ColorGCCacheBuffer_Destroy(ColorGCCacheBuffer buffer) { if (buffer == NULL) return (NULL); free(buffer); return (NULL); } /*---------------------------------------------------------------------------*/ /* キャッシュ */ /*---------------------------------------------------------------------------*/ static ColorGCCache ColorGCCache_Create(ColorGCList color_gc_list, int size) { ColorGCCache cache; cache = (ColorGCCache)malloc(sizeof(_ColorGCCache)); if (cache == NULL) Error("ColorGCCache_Create", "Cannot allocate memory."); cache->size = size; cache->color_gc_list = color_gc_list; cache->buffer_list = ObjList_Create(); return (cache); } static ColorGCCache ColorGCCache_Destroy(ColorGCCache cache) { if (cache == NULL) return (NULL); if (cache->buffer_list) ObjList_Destroy(cache->buffer_list); free(cache); return (NULL); } /*---------------------------------------------------------------------------*/ /* キャッシュから ColorGCInstance を得る. */ /*---------------------------------------------------------------------------*/ static ColorGCInstance ColorGCCache_GetColorGCInstance(ColorGCCache cache, XColor color) { ObjListData current; ColorGCCacheBuffer buffer; ColorGCInstance instance; int cmp; /* キャッシュの中を検索 */ for (current = ObjList_GetStart(cache->buffer_list); !ObjList_IsEndEdge(cache->buffer_list, current); current = ObjListData_GetNext(current)) { buffer = (ColorGCCacheBuffer)ObjListData_GetObj(current); cmp = ColorGCInstance_CmpToColor(buffer->instance, color); if (cmp == 0) { /* キャッシュ中に見つけた場合 */ #ifdef HIT_CACHE fprintf(stderr, "H"); /* Hit! */ #endif ObjList_MoveObjToStart(cache->buffer_list, current); return (buffer->instance); } } /* キャッシュ中に見つけられなかった場合 */ /* リストから検索する */ instance = ColorGCList_GetColorGCInstance(cache->color_gc_list, color); /* キャッシュに追加する */ if (ObjList_GetLength(cache->buffer_list) < cache->size) { buffer = ColorGCCacheBuffer_Create(instance); ObjList_InsertObjToStart(cache->buffer_list, buffer, (ObjDestructor)ColorGCCacheBuffer_Destroy); } else { current = ObjList_GetEnd(cache->buffer_list); buffer = (ColorGCCacheBuffer)ObjListData_GetObj(current); buffer->instance = instance; ObjList_MoveObjToStart(cache->buffer_list, current); } #ifdef HIT_CACHE fprintf(stderr, "F"); /* False! */ #endif return (instance); } /*===========================================================================*/ /* ColorGCHash 関連 */ /*===========================================================================*/ static ColorGCHash ColorGCHash_Create(Disp disp, int studying_flag, int cache_flag, int cache_size, int hash_number) { ColorGCHash hash; int i; hash = (ColorGCHash)malloc(sizeof(_ColorGCHash)); if (hash == NULL) Error("ColorGCHash_Create", "Cannot allocate memory."); hash->number = hash_number; hash->cache_flag = cache_flag; if (cache_flag) { hash->color_gc_cache = (ColorGCCache *)malloc(sizeof(ColorGCCache) * hash->number); if (hash->color_gc_cache == NULL) Error("ColorGCHash_Create", "Cannot allocate memory."); } else { hash->color_gc_cache = NULL; } hash->color_gc_list = (ColorGCList *)malloc(sizeof(ColorGCList) * hash->number); if (hash->color_gc_list == NULL) Error("ColorGCHash_Create", "Cannot allocate memory."); for (i = 0; i < hash->number; i++) { hash->color_gc_list[i] = ColorGCList_Create(disp, studying_flag); if (cache_flag) { hash->color_gc_cache[i] = ColorGCCache_Create(hash->color_gc_list[i], cache_size); } } return (hash); } static ColorGCHash ColorGCHash_Destroy(ColorGCHash hash) { int i; if (hash == NULL) return (NULL); if (hash->color_gc_cache) { for (i = 0; i < hash->number; i++) { if (hash->color_gc_cache[i]) ColorGCCache_Destroy(hash->color_gc_cache[i]); } free(hash->color_gc_cache); } if (hash->color_gc_list) { for (i = 0; i < hash->number; i++) { if (hash->color_gc_list[i]) ColorGCList_Destroy(hash->color_gc_list[i]); } free(hash->color_gc_list); } free(hash); return (NULL); } static void ColorGCHash_OutputHashStatus(ColorGCHash hash) { int i; printf ("\nHash :"); for (i = 0; i < hash->number; i++) { printf("%d ", ObjList_GetLength(hash->color_gc_list[i]->list)); } printf ("\n"); } /*---------------------------------------------------------------------------*/ /* ハッシュ関数 */ /* 色を減色している場合,特定の位置だけ頻繁に使用されたりしないように注意. */ /* (たとえば, */ /* ((int)color.red*3 + (int)color.green*2 + (int)color.blue) % hash->number */ /* のようなハッシュ関数だと,16階調に減色したときに,4096 の倍数の位置だけ */ /* 頻繁に使用されてしまう. */ /*---------------------------------------------------------------------------*/ static int HashFunction(ColorGCHash hash, XColor color) { return (( (((int)color.red) / 3000) * 11 + (((int)color.green) % 3000) / 7 + (((int)color.blue) % 1000) / 3 ) % hash->number); } /*---------------------------------------------------------------------------*/ /* ハッシュから ColorGCInstance を得る. */ /*---------------------------------------------------------------------------*/ static ColorGCInstance ColorGCHash_GetColorGCInstance(ColorGCHash hash, XColor color) { int n; n = HashFunction(hash, color); if (hash->cache_flag) return (ColorGCCache_GetColorGCInstance(hash->color_gc_cache[n], color)); else return (ColorGCList_GetColorGCInstance(hash->color_gc_list[n], color)); } /*===========================================================================*/ /* ColorName 関連 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ static ColorName ColorName_Create(Disp disp, char * name) { ColorName color_name; color_name = (ColorName)malloc(sizeof(_ColorName)); if (color_name == NULL) Error("ColorName_Create", "Cannot allocate memory"); color_name->name = malloc(sizeof(char) * (StringLen(name) + 1)); if (color_name->name == NULL) Error("ColorName_Create", "Cannot allocate memory"); StringCpy(color_name->name, name); XParseColor(Disp_GetDisplay(disp), Disp_GetColormap(disp), color_name->name, &(color_name->color)); return (color_name); } /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ static ColorName ColorName_Destroy(ColorName color_name) { if (color_name == NULL) return (NULL); if (color_name->name) free(color_name->name); free(color_name); return (NULL); } /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ static ColorNameList ColorNameList_Create(Disp disp) { ColorNameList list; list = (ColorNameList)malloc(sizeof(_ColorNameList)); if (list == NULL) Error("ColorNameList_Create", "Cannot allocate memory"); list->disp = disp; list->list = ObjList_Create(); return (list); } /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ static ColorNameList ColorNameList_Destroy(ColorNameList list) { if (list == NULL) return (NULL); if (list->list) ObjList_Destroy(list->list); free(list); return (NULL); } /*---------------------------------------------------------------------------*/ /* 文字列で与えられた色名から,RGB値を検索する. */ /*---------------------------------------------------------------------------*/ static XColor ColorNameList_GetColor(ColorNameList list, char * name) { ObjListData current; ColorName color_name; for (current = ObjList_GetStart(list->list); !ObjList_IsEndEdge(list->list, current); current = ObjListData_GetNext(current)) { color_name = (ColorName)ObjListData_GetObj(current); if (StringEqual(color_name->name, name)) { ObjList_MoveObjToStart(list->list, current); return (color_name->color); } } color_name = ColorName_Create(list->disp, name); if (color_name == NULL) Error("ColorNameList_GetColor", "Cannot create ColorName"); ObjList_InsertObjToStart(list->list, color_name, (ObjDestructor)ColorName_Destroy); return (color_name->color); } /*===========================================================================*/ /* ColorGC 関連 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ ColorGC ColorGC_Create(ColorGCDatabase database, XColor color) { ColorGC color_gc; color_gc = (ColorGC)malloc(sizeof(_ColorGC)); /* ハッシュから色とGCを検索 */ color_gc->instance = ColorGCHash_GetColorGCInstance(database->hash, color); return (color_gc); } ColorGC ColorGC_CreateFromColorGC(ColorGCDatabase database, ColorGC c) { ColorGC color_gc; color_gc = (ColorGC)malloc(sizeof(_ColorGC)); color_gc->instance = c->instance; return (color_gc); } /*---------------------------------------------------------------------------*/ /* RGB 値から生成する. */ /*---------------------------------------------------------------------------*/ ColorGC ColorGC_CreateFromRGB(ColorGCDatabase database, int red, int green, int blue) { XColor color; color.red = red; color.green = green; color.blue = blue; color.flags = DoRed | DoGreen | DoBlue; return (ColorGC_Create(database, color)); } /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ ColorGC ColorGC_Destroy(ColorGC color_gc) { if (!color_gc) return (NULL); free(color_gc); return (NULL); } /*===========================================================================*/ /* 文字列読み込み用関数 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* 色の節約のための,減色用の関数. */ /* 減色すると,色の共有化が進み,キャッシングの効果が大きくなる. */ /* あるていど減色しないと,色が共有できないので,無駄が多くなる. */ /*---------------------------------------------------------------------------*/ static XColor DecreaseColor(XColor color, int gradation) { int div = RGB_MAX_VALUE / gradation + 1; color.red /= div; if (color.red >= gradation - 1) color.red = RGB_MAX_VALUE; else color.red *= div; color.green /= div; if (color.green >= gradation - 1) color.green = RGB_MAX_VALUE; else color.green *= div; color.blue /= div; if (color.blue >= gradation - 1) color.blue = RGB_MAX_VALUE; else color.blue *= div; return (color); } /*---------------------------------------------------------------------------*/ /* 色とGCのデータベースから name で与えられた名前の色を検索する. */ /*---------------------------------------------------------------------------*/ ColorGC ColorGC_CreateFromCharacters(ColorGCDatabase database, char * name) { XColor color; if (!StringCmp(name, "none") || !StringCmp(name, "None") || !StringCmp(name, "NONE") || !StringCmp(name, "back") || !StringCmp(name, "Back") || !StringCmp(name, "BACK") || !StringCmp(name, "background") || !StringCmp(name, "Background") || !StringCmp(name, "BACKGROUND")) { if (database->background_color_gc) return (ColorGC_CreateFromColorGC(database, database->background_color_gc)); else #if 1 name = "none"; #else name = "black"; #endif } color = ColorNameList_GetColor(database->color_name_list, name); /* 色の節約のため,減色する */ color = DecreaseColor(color, database->gradation); return (ColorGC_Create(database, color)); } /*---------------------------------------------------------------------------*/ /* XColor 構造体の取得 */ /*---------------------------------------------------------------------------*/ XColor ColorGC_GetColor(ColorGC color_gc) { return (color_gc->instance->color); } /*---------------------------------------------------------------------------*/ /* ピクセル値の取得 */ /*---------------------------------------------------------------------------*/ unsigned long ColorGC_GetPixel(ColorGC color_gc) { return (color_gc->instance->color.pixel); } /*---------------------------------------------------------------------------*/ /* GC の取得 */ /*---------------------------------------------------------------------------*/ GC ColorGC_GetGC(ColorGC color_gc) { return (color_gc->instance->gc); } /*---------------------------------------------------------------------------*/ /* 色の明るさの取得 */ /*---------------------------------------------------------------------------*/ int GetBrightness(XColor color) { long int br; #if 0 br = color.red > color.green ? color.red : color.green; br = br > color.blue ? br : color.blue; br = br * 100 / RGB_MAX_VALUE; #else br = color.red + color.green + color.blue; br = br * 100 / RGB_MAX_VALUE; #endif if (br > 100) br = 100; return ((int)br); } /*===========================================================================*/ /* GC のリストの作成 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* 単語の読み込み用.(Stream ライブラリ使用) */ /*---------------------------------------------------------------------------*/ static char * GetWord(Stream stream) { char * word; word = Stream_GetWord(stream, NULL, 0, "", /* この文字で切り分ける */ " \t", /* この文字でも切り分ける */ "", /* コメント行の先頭文字 '#' など */ "\n", /* 行末文字 '\n' など */ "", /* 引用符文字 '\"' など */ "", /* 文字列先頭の読みとばし文字 */ "" /* 文字列末尾の読みとばし文字 */ ); return (word); } /*---------------------------------------------------------------------------*/ /* color1 と color2 で与えられた色の中間色を計算する */ /* per でパーセンテージを与える. */ /* 0% のとき,color1になる.100%のとき,color2 になる */ /* 0% 未満か,100%より大きな per のときには,flags メンバに0を設定して */ /* 返す.それ以外のときは,flags メンバは DoRed | DoGreen | DoBlue になる. */ /*---------------------------------------------------------------------------*/ static XColor CalMiddleColor(XColor color1, XColor color2, int per) { XColor color; color.pixel = 0; if ((per < 0) || (per > 100)) { color.flags = 0; color.red = 0; color.green = 0; color.blue = 0; return (color); } /* 中間色の計算 */ color.flags = DoRed | DoGreen | DoBlue; color.red = color1.red + (int)(((color2.red - color1.red ) * per + 50) / 100); color.green = color1.green + (int)(((color2.green - color1.green) * per + 50) / 100); color.blue = color1.blue + (int)(((color2.blue - color1.blue ) * per + 50) / 100); return (color); } /*---------------------------------------------------------------------------*/ /* GC のリストの作成 */ /* "red" "black" 10 */ /* のような引数から,GCのリストを生成して返す. */ /*---------------------------------------------------------------------------*/ static ObjList CreateGCList(ColorGCDatabase database, XColor start_color, XColor end_color, int length) { ColorGC color_gc; ObjList gc_list; XColor middle_color; int i, per; gc_list = ObjList_Create(); for (i = 0; i < length; i++) { if (length == 1) per = 100; else per = i * 100 / (length - 1) ; middle_color = CalMiddleColor(start_color, end_color, per); /* 色の節約のため,減色する */ middle_color = DecreaseColor(middle_color, database->gradation); color_gc = ColorGC_Create(database, middle_color); ObjList_InsertObjToEnd(gc_list, color_gc, (ObjDestructor)ColorGC_Destroy); } return (gc_list); } /*---------------------------------------------------------------------------*/ /* GC のリストの作成 */ /* データ文字列から ColorGC のリストを作成し,返す. */ /* データ文字列のフォーマットは以下のとおり. */ /* "[スタートカラー1] [エンドカラー1] [長さ1] [スタートカラー2] ...\0" */ /* 例) "red green 10 green blue 20 blue none 10\0" */ /*---------------------------------------------------------------------------*/ ObjList CreateColorGCListFromCharacters(ColorGCDatabase database, char * data, int after_image_length, int fine, int color_length_mag) { Stream stream; char * start; char * end; char * len; int length; int length2; ObjList gc_list; ObjList list; ColorGC start_color_gc; ColorGC end_color_gc; XColor middle_color; int i, per; int br; list = ObjList_Create(); if (!data) return (list); stream = Stream_CreateFromCharacters(data); if (!stream) return (list); while ((start = GetWord(stream)) != NULL) { end = GetWord(stream); if (end == NULL) end = "none"; len = GetWord(stream); if (len == NULL) len = "1"; start_color_gc = ColorGC_CreateFromCharacters(database, start); end_color_gc = ColorGC_CreateFromCharacters(database, end ); length = (atoi(len) * color_length_mag + 50) / 100; if (length > 0) { length = (length * fine + 50) / 100; #if 0 if (length < 1) length = 1; #endif } for (i = 0; i < length; i++) { if (length == 1) per = 100; else per = i * 100 / (length - 1) ; middle_color = CalMiddleColor(start_color_gc->instance->color, end_color_gc->instance->color, per); #if 0 /* 減色の必要なし */ /* 色の節約のため,減色する */ middle_color = DecreaseColor(middle_color, database->gradation); #endif br = GetBrightness(middle_color); length2 = after_image_length; if (length2 > 0) { length2 = (length2 * fine + 50) / 100; #if 0 if (length2 < 1) length2 = 1; #endif } length2 = (length2 * br + 50) / 100; gc_list = CreateGCList(database, middle_color, database->background_color_gc->instance->color, length2); ObjList_InsertObjToEnd(list, gc_list, (ObjDestructor)ObjList_Destroy); } ColorGC_Destroy(start_color_gc); ColorGC_Destroy(end_color_gc); if (start) free(start); if (end) free(end); if (len) free(len); } Stream_Destroy(stream); return (list); } /*===========================================================================*/ /* GC のデータベース */ /*===========================================================================*/ ColorGCDatabase ColorGCDatabase_Create(Disp disp, int studying_flag, int cache_flag, int cache_size, int hash_number, char * background, int gradation) { ColorGCDatabase database; database = (ColorGCDatabase)malloc(sizeof(_ColorGCDatabase)); if (database == NULL) Error("ColorGCDatabase_Create", "Cannot allocate memory."); database->disp = disp; database->gradation = gradation; database->hash = ColorGCHash_Create(database->disp, studying_flag, cache_flag, cache_size, hash_number); database->color_name_list = ColorNameList_Create(database->disp); /* background が "none" の場合にも正常動作するように, */ /* ColorGC_CreateFromCharacters()を呼び出す前に,NULL で初期化する. */ database->background_color_gc = NULL; /* 引数に database を入れて呼び出すので,必ず最後に置くこと */ database->background_color_gc = ColorGC_CreateFromCharacters(database, background); /* この直後に return() が来るようにすること */ return (database); } ColorGCDatabase ColorGCDatabase_Destroy(ColorGCDatabase database) { if (database == NULL) return (NULL); if (database->background_color_gc) ColorGC_Destroy(database->background_color_gc); if (database->color_name_list) ColorNameList_Destroy(database->color_name_list); if (database->hash) ColorGCHash_Destroy(database->hash); free(database); return (NULL); } ColorGC ColorGCDatabase_GetBackgroundColorGC(ColorGCDatabase database) { return (database->background_color_gc); } /*---------------------------------------------------------------------------*/ /* チューニング用 */ /*---------------------------------------------------------------------------*/ void ColorGCDatabase_OutputHashStatus(ColorGCDatabase database) { ColorGCHash_OutputHashStatus(database->hash); } /*****************************************************************************/ /* End of File */ /*****************************************************************************/ xfireworks-1.3.orig/ColorGC.h0100644000175000017500000001261207142030233015235 0ustar kmutokmuto/*****************************************************************************/ /* ColorGC GCと色の管理・問い合わせ用のライブラリ */ /*****************************************************************************/ #ifndef _XFIREWORKS_ColorGC_h_INCLUDED_ #define _XFIREWORKS_ColorGC_h_INCLUDED_ typedef struct _ColorGCDatabase * ColorGCDatabase; typedef struct _ColorGC * ColorGC; #include #include "Disp.h" #include "Obj.h" /*===========================================================================*/ /* ColorGC 関連 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* オブジェクトの生成 */ /*---------------------------------------------------------------------------*/ ColorGC ColorGC_Create(ColorGCDatabase database, XColor color); ColorGC ColorGC_CreateFromColorGC(ColorGCDatabase database, ColorGC c); /*---------------------------------------------------------------------------*/ /* RGB 値から生成する. */ /*---------------------------------------------------------------------------*/ ColorGC ColorGC_CreateFromRGB(ColorGCDatabase database, int red, int green, int blue); /*---------------------------------------------------------------------------*/ /* オブジェクトの削除 */ /*---------------------------------------------------------------------------*/ ColorGC ColorGC_Destroy(ColorGC color_gc); /*===========================================================================*/ /* 文字列読み込み用関数 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* 色とGCのデータベースから name で与えられた名前の色を検索する. */ /*---------------------------------------------------------------------------*/ ColorGC ColorGC_CreateFromCharacters(ColorGCDatabase database, char * name); /*---------------------------------------------------------------------------*/ /* XColor 構造体の取得 */ /*---------------------------------------------------------------------------*/ XColor ColorGC_GetColor(ColorGC color_gc); /*---------------------------------------------------------------------------*/ /* ピクセル値の取得 */ /*---------------------------------------------------------------------------*/ unsigned long ColorGC_GetPixel(ColorGC color_gc); /*---------------------------------------------------------------------------*/ /* GC の取得 */ /*---------------------------------------------------------------------------*/ GC ColorGC_GetGC(ColorGC color_gc); /*---------------------------------------------------------------------------*/ /* 色の明るさの取得 */ /*---------------------------------------------------------------------------*/ int GetBrightness(XColor color); /*===========================================================================*/ /* GC のリストの作成 */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* GC のリストの作成 */ /* データ文字列から ColorGC のリストを作成し,返す. */ /* データ文字列のフォーマットは以下のとおり. */ /* "[スタートカラー1] [エンドカラー1] [長さ1] [スタートカラー2] ...\0" */ /* 例) "red green 10 green blue 20 blue none 10\0" */ /*---------------------------------------------------------------------------*/ ObjList CreateColorGCListFromCharacters(ColorGCDatabase database, char * data, int after_image_length, int fine, int color_length_mag); /*===========================================================================*/ /* GC のデータベース */ /*===========================================================================*/ ColorGCDatabase ColorGCDatabase_Create(Disp disp, int studying_flag, int cache_flag, int cache_size, int hash_number, char * background, int gradation); ColorGCDatabase ColorGCDatabase_Destroy(ColorGCDatabase database); ColorGC ColorGCDatabase_GetBackgroundColorGC(ColorGCDatabase database); /*---------------------------------------------------------------------------*/ /* チューニング用 */ /*---------------------------------------------------------------------------*/ void ColorGCDatabase_OutputHashStatus(ColorGCDatabase database); #endif /*****************************************************************************/ /* End of File */ /*****************************************************************************/ xfireworks-1.3.orig/PieceP.h0100644000175000017500000000325207142030233015112 0ustar kmutokmuto#ifndef _XFIREWORKS_PieceP_h_INCLUDED_ #define _XFIREWORKS_PieceP_h_INCLUDED_ #include "Piece.h" typedef struct _PieceClass { char * name; /* 名称 */ int size; /* 玉の大きさ(直径) */ double probability; /* 出現する確率 */ double air; /* 空気抵抗 */ double gravity; /* 重力加速度 */ double transmission; /* 爆発時に,前の玉から速度が何%伝わるか */ int after_image_length; /* 残像の長さ */ int fine; /* 移動の細かさ(逆数は,玉の移動のステップ数になる)*/ double step; /* 玉の移動のステップ数.(fine の逆数) */ ObjList gc_list_list; /* AfterImages の色変化用のGCのリストのリスト */ ObjList next_list; /* PieceNext のリスト.爆発時に生成する玉のリスト */ } _PieceClass; typedef struct _PieceNext { PieceClass piece_class; double power; /* 爆発の強さ */ int number; /* 爆発のときに出す玉の数 */ } _PieceNext; typedef struct _Pieces { PieceClass piece_class; int array_size; /* 配列のサイズ */ int number; /* Pieces の数(メインループでの malloc() の呼び出し数を減らすため, */ /* Pieces オブジェクトは使い回しするので,size != number になる場合がある) */ double * x; /* 位置 */ double * y; /* 位置 */ double * z; /* 位置(奥行き) */ double * vx; /* 速度 */ double * vy; /* 速度 */ double * vz; /* 速度(奥行き) */ ObjListData gc_list; /* 色の変化用.現在の色を指す */ } _Pieces; #endif /* _XFIREWORKS_PieceP_h_INCLUDED_ */ /*****************************************************************************/ /* End of Program */ /*****************************************************************************/ xfireworks-1.3.orig/COPYRIGHT0100644000175000017500000000702107142030233015065 0ustar kmutokmuto/*****************************************************************************/ /* XFireworks - fireworks on X. */ /* */ /* XFireworks Copyright (c) 2000 Sakai Hiroaki. */ /* All Rights Reserved. */ /*===========================================================================*/ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2, or (at your option) */ /* any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; see the file COPYING. If not, write to */ /* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /*****************************************************************************/ /*****************************************************************************/ /* 本ソフトウエアの著作権は全て「坂井弘亮」が有します. */ /* 本ソフトウエアは,フリーソフトです. */ /* 本ソフトウエアのライセンスには,GNU General Public License を適用します. */ /* 本ソフトウエアは,GNU General Public License の下での */ /* コピー/修正/改良/再配布が可能です. */ /* GPL については,詳しくは,COPYING を参照してください. */ /*===========================================================================*/ /* 本ソフトウェアを使用することによって発生したあらゆる損害の責任は */ /* 使用者にあり,著作権者はその責任を一切負いません. */ /* 本ソフトウエアの改良やバージョンアップや移植などの義務は, */ /* 著作権者には一切ありません. */ /*===========================================================================*/ /* 日本語のドキュメントの文章の内容と,英語のドキュメントの文章の内容の間に */ /* 差異が生じた場合には,日本語のドキュメントの文章の内容が,正しい意志で */ /* あるものとします. */ /*===========================================================================*/ /* 坂井弘亮の連絡先のメールアドレスは, */ /* sakai@seki.ee.kagu.sut.ac.jp */ /* hsakai@pfu.co.jp */ /* です.また,本ソフトウエアの最新版を, */ /* http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/index.html */ /* で配布しています. */ /* ご意見,ご感想がありましたら,ぜひ連絡ください. */ /*****************************************************************************/ xfireworks-1.3.orig/ColorGCP.h0100644000175000017500000001354307142030233015361 0ustar kmutokmuto/*****************************************************************************/ /* ColorGC GCと色の管理・問い合わせ用のライブラリ */ /*****************************************************************************/ #ifndef _XFIREWORKS_ColorGCP_h_INCLUDED_ #define _XFIREWORKS_ColorGCP_h_INCLUDED_ #include "ColorGC.h" #define RGB_MAX_VALUE 65535 /*===========================================================================*/ /* XFireworks は,描画の高速化のために,描画に必要な色と GC は,起動時に */ /* すべて確保するのですが,無駄な X サーバへのリクエストとメモリの浪費を */ /* 減らすために,いったん確保した色と GC はデータベースに記憶しておき, */ /* 同じ色が必要になったときには,共有するようにします. */ /* (ColorGCDatabase はそのためのクラスです) */ /* これにより,XAllocColor() による色の問い合わせ待ちが減るため, */ /* 起動が格段に高速になります. */ /* データベースの検索には,ハッシュ,キャッシュ,学習機能を使用することが */ /* できます. */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /* 以下を有効にすると,同じ色のGCがどれくらい共有されているか調べることが */ /* できます. */ /*---------------------------------------------------------------------------*/ /* #define HIT_LIST */ /*---------------------------------------------------------------------------*/ /* 以下を有効にすると,キャッシュのヒット率を調べることができます. */ /*---------------------------------------------------------------------------*/ /* #define HIT_CACHE */ /*===========================================================================*/ /* GC の実体を管理するクラス */ /*===========================================================================*/ typedef struct _ColorGCInstance * ColorGCInstance; typedef struct _ColorGCInstance { Disp disp; GC gc; XColor color; } _ColorGCInstance; /*===========================================================================*/ /* GC の実体のリストを管理するクラス */ /* 同一の色のGCは共有したいため,GCの実体をリストで管理し,GCの取得要求に */ /* 対して,適切な ColorGCInstance を返す. */ /* (すでに存在するのならそれを返し,無ければ Create する) */ /*===========================================================================*/ typedef struct _ColorGCList * ColorGCList; typedef struct _ColorGCList { /* GC の管理用 */ Disp disp; int studying_flag; /* 学習機能のON/OFFのフラグ */ ObjList list; /* ColorGCInstance のリスト */ } _ColorGCList; /*===========================================================================*/ /* キャッシュ */ /*===========================================================================*/ typedef struct _ColorGCCacheBuffer * ColorGCCacheBuffer; typedef struct _ColorGCCache * ColorGCCache; /* キャッシュ用バッファ */ typedef struct _ColorGCCacheBuffer { ColorGCInstance instance; } _ColorGCCacheBuffer; /* キャッシュ */ typedef struct _ColorGCCache { int size; /* キャッシュサイズ */ ColorGCList color_gc_list; ObjList buffer_list; } _ColorGCCache; /*===========================================================================*/ /* ハッシュ */ /*===========================================================================*/ typedef struct _ColorGCHash * ColorGCHash; typedef struct _ColorGCHash { int number; /* ハッシュの個数 */ int cache_flag; /* キャッシュの使用・未使用のフラグ */ ColorGCCache * color_gc_cache; ColorGCList * color_gc_list; } _ColorGCHash; /*===========================================================================*/ /* 色の名前とRGB値の対応を管理するためのクラス */ /*===========================================================================*/ typedef struct _ColorName * ColorName; typedef struct _ColorNameList * ColorNameList; typedef struct _ColorName { char * name; XColor color; } _ColorName; typedef struct _ColorNameList { Disp disp; ObjList list; /* ColorName のリスト */ } _ColorNameList; /*===========================================================================*/ /* 色と GC のデータベース */ /* GC の検索には,ハッシュを用いる. */ /*===========================================================================*/ typedef struct _ColorGCDatabase { /* GC の管理用 */ Disp disp; ColorGCHash hash; /* ハッシュ */ ColorNameList color_name_list; /* 色名 → RGB値の変換用 */ /* 背景色.色名で"none"を指定すると,この色が使用される. */ ColorGC background_color_gc; /* 減色数.16階調にするときには16を指定 */ /* 10階調や20階調も指定可能 */ int gradation; } _ColorGCDatabase; /*===========================================================================*/ /* GC を管理するクラス */ /* 同じ色の GC が重複しない用に,ColorGCList で GC を管理して, */ /* 色の要求時には,ColorGCList から GC をもらうようにする. */ /*===========================================================================*/ typedef struct _ColorGC { ColorGCInstance instance; } _ColorGC; #endif /*****************************************************************************/ /* End of File */ /*****************************************************************************/ xfireworks-1.3.orig/ChangeLog0100644000175000017500000000167007142030233015350 0ustar kmutokmuto2000.8.2 XFireworks-1.3 Manage and reuse of second-hand Pieces and AfterImages objests are added to decrease calling malloc() in main loop to decrease load average. (See free_pieces_list and free_after_images_list member of XFireworks class) Bug of ObjList_IsEnd() was modified. (Obj.c) Targets install-bin, install-lib, and install-man in Makefile are modified. 2000.8.1 XFireworks-1.2 Added ColorName and ColorNameList class to manage color name and RGB value to decrease calling XParseColor(). XFireworks starts up more speedy. In Pieces_Create(), collect 6 malloc() to one to decrease load average. Change the directry to put xfireworks.conf from /lib/X11/XFireworks to /etc. Changes Makefile a little. 2000.7.29 XFireworks-1.1 Added Calculator.c to decrease load average. Pieces_Create() and Pieces_Move() were modified to decrease load average. 2000.7.28 XFireworks-1.0 first version. xfireworks-1.3.orig/configure.h0100644000175000017500000000363307142030232015730 0ustar kmutokmuto/* configure.h for configuration of xfireworks */ #define DEFAULT_DISPLAY NULL /* #define DEFAULT_DISPLAY ":0.0" */ #define DEFAULT_DIRECT_DRAW 1 #define DEFAULT_BACKGROUND_COLOR "black" #define DEFAULT_FILENAME "xfireworks.conf" /* Parameters for tuning hash and cache of colors. */ #define DEFAULT_STUDYING_FLAG 0 #define DEFAULT_CACHE_FLAG 1 #define DEFAULT_CACHE_SIZE 5 #define DEFAULT_HASH_NUMBER 130 /* Other parameters. */ #define DEFAULT_PIECES_MAX_NUMBER 100 #define DEFAULT_FINE 100 /* #define DEFAULT_FINE 75 */ /* for slow machine. */ /* #define DEFAULT_FINE 150 */ /* for fast machine. */ #define DEFAULT_WAIT 0 /* If color gradation is a little, colors are shared, memory of */ /* X server and xfireworks are saved, and xfireworks starts up speedy. */ #define DEFAULT_GRADATION 16 /* #define DEFAULT_GRADATION 4 */ /* for less color and slow machine. */ /* #define DEFAULT_GRADATION 64 */ /* for high color and fast machine. */ /* Some parameters are magnified by these values. */ #define DEFAULT_PROBABILITY_MAGNIFICATION 100 #define DEFAULT_SIZE_MAGNIFICATION 100 #define DEFAULT_AIR_MAGNIFICATION 100 #define DEFAULT_GRAVITY_MAGNIFICATION 100 #define DEFAULT_TRANSMISSION_MAGNIFICATION 100 #define DEFAULT_AFTER_IMAGE_MAGNIFICATION 100 #define DEFAULT_COLOR_LENGTH_MAGNIFICATION 100 #define DEFAULT_NEXT_POWER_MAGNIFICATION 100 #define DEFAULT_NEXT_NUMBER_MAGNIFICATION 100 /* Default values. If default values are not defined in xfireworks.conf, */ /* these values are used. */ /* (If default values are defined in xfireworks.conf, they are used first.) */ #define DEFAULT_PROBABILITY 0.1 #define DEFAULT_SIZE 3 #define DEFAULT_AIR 0.05 #define DEFAULT_GRAVITY 0.3 #define DEFAULT_TRANSMISSION 60.0 #define DEFAULT_AFTER_IMAGE 10 /* End of configure.h */ xfireworks-1.3.orig/XFireworksP.h0100644000175000017500000000204407142030233016166 0ustar kmutokmuto#ifndef _XFIREWORKS_XFireworksP_h_INCLUDED_ #define _XFIREWORKS_XFireworksP_h_INCLUDED_ #include "XFireworks.h" #include "Obj.h" #include "Disp.h" #include "Disp.h" #include "ColorGC.h" #include "Calculator.h" /* 以下を有効にすると,ハッシュの使用度を表示することができます */ /* #define OUTPUT_HASH_STATUS */ typedef struct _XFireworks { ObjList piece_class_list; /* メインループでの malloc() の呼び出しを減らすために, */ /* 一度作成した Pieces, AfterImages オブジェクトは,使い終っても */ /* 削除せず,free のリストに追加して保存しておき,使い回すようにする. */ ObjList pieces_list; /* 使用中の Pieces オブジェクトのリスト */ ObjList free_pieces_list; /* 使用してない Pieces オブジェクトのリスト */ ObjList after_images_list; /* 使用中の残像オブジェクトのリスト */ ObjList free_after_images_list; /* 使用してない残像オブジェクトのリスト */ Disp disp; ColorGCDatabase color_gc_database; Calculator calculator; /* sin, cos の計算用 */ } _XFireworks; #endif /* _XFIREWORKS_XFireworksP_h_INCLUDED_ */